Download Error checking and Ethernet

Document related concepts

VMEbus wikipedia , lookup

IEEE 802.1aq wikipedia , lookup

Low-voltage differential signaling wikipedia , lookup

Point-to-Point Protocol over Ethernet wikipedia , lookup

Power over Ethernet wikipedia , lookup

Computer network wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

RS-232 wikipedia , lookup

Bus (computing) wikipedia , lookup

Serial port wikipedia , lookup

I²C wikipedia , lookup

Wake-on-LAN wikipedia , lookup

Airborne Networking wikipedia , lookup

CAN bus wikipedia , lookup

UniPro protocol stack wikipedia , lookup

IEEE 1355 wikipedia , lookup

Transcript
Packets, Frames and Error
Detection
Based on Chapter 7 in Computer
Networks and Internets (Comer,
Third Edition)
CSIT 220 (Blum)
1
Modem error-checking
protocols
• Data is chunked into "blocks" of a certain byte
size and sent to the destination modem.
• The destination modem checks each block for
errors and returns
– ACK if no errors are found
– NAK if errors are found, which leads to a
retransmission.
• The kind of checking (checksum or cyclic
redundancy checking) varies from protocol to
protocol.
CSIT 220 (Blum)
2
ASCII
CSIT 220 (Blum)
3
Error Detection
• If certain timing restrictions of the protocol are not
met, the receiver may not be able to interpret the
signal that arrived as binary data
– Recall that in the RS232 protocol two 1’s is
distinguished from one 1 by the length of time the
signal is at –15 V
• But other problems can yield a signal which can
be interpreted as binary data — but not the binary
data sent.
• For this reason, protocols include error detection
schemes (like parity, checksums or cyclic
redundancy checks) to validate the data received.
CSIT 220 (Blum)
4
Error Detection (Cont.)
• Error detection schemes involve
transmitting additional information which
the receiver can use to validate the data.
• Error detection can inform the receiver of
the presence of an error but cannot fix the
error, the package must be resent.
• Error correction schemes (which are
distinct) attempt to pinpoint the error.
CSIT 220 (Blum)
5
Parity
• Parity is a simple error detection scheme.
• The transmitter and receiver agree ahead of
time on the type of parity they will use
(even or odd). Let us assume even.
• The transmitter takes a string of binary data
and calculates whether the number of 1’s in
the string is even or odd.
CSIT 220 (Blum)
6
Parity (Cont.)
• The transmitter includes an extra bit:
– 0 if the number of data-bit 1’s is even;
– 1 if the number of data-bits 1’s is odd.
• The string consisting of the data plus parity bit is
now guaranteed to have an even number of 1’s.
• The receiver checks that the data plus parity bit
have even parity (an even number of 1’s).
• If the data received has odd parity, some
transmission error must have occurred.
CSIT 220 (Blum)
7
Parity (Cont.)
D
D
D
D
D
D
D
D
P
0
0
0
1
1
1
0
0
1
0
0
1
0
1
0
0
0
0
0
1
0
1
1
1
0
0
?
1
1
1
1
0
0
0
1
?
D – data
CSIT 220 (Blum)
P – parity
8
Parity (Cont.)
• (You may read that the number of 1’s is
counted, this is not true and is unnecessary
complicated.)
• A multi-input XOR (excluded OR) gate will
determine the parity bit, this circuitry is
much simpler than what is required for
counting the number of 1’s.
CSIT 220 (Blum)
9
2-input and 3-input XOR Truth Tables
A
0
B
0
Output
0
0
1
1
1
0
1
1
1
0
Output is true when
number of inputs is odd.
CSIT 220 (Blum)
A
0
0
0
0
1
1
1
1
B
0
0
1
1
0
0
1
1
C
0
1
0
1
0
1
0
1
Output
0
1
1
0
1
0
0
1
10
Parity (Cont.)
• Parity is used when data is moved around
within computers as well as when data is
sent from computer to computer.
• Modems use parity. Users may also select
no parity, meaning that the modems will not
include the parity bit. Sending fewer bits
speeds up transmission.
CSIT 220 (Blum)
11
Checksum
• The transmission string of data bits is broken up
into units, for instance of consisting of 16 bits
each.
• These 16-bit numbers are then added (any carries,
if the sum is larger than a 16-bit number, are
added to the sum).
• The sum is sent along as part of the frame’s trailer
field.
• The receiver repeats the calculation. If the sums
match, it's assumed that no transmission error
occurred.
CSIT 220 (Blum)
12
Checksum (Cont.)
• Actually instead of including the sum in the
trailer, one can transmit instead its negative.
• The receiver then repeats the sum over the
data and includes in the summation the
negative of the sum sent in the trailer.
• The result should be zero. It is easier to test
for a result of all zeros.
CSIT 220 (Blum)
13
Catching errors
• Since the 16-bit string might end up in any
of 216 (65536) possible states, you might
assume that the checksum would catch
errors 65535/65536  99.9985% of the time.
• But this would assume that all possible
errors are equally likely, which is not true.
CSIT 220 (Blum)
14
Burst errors
• For multi-bit errors, it is more likely that a
group of consecutive bits are affected as
opposed to randomly selected bits, such an
error is known as a burst error.
• It is also common for periodic errors to
occur (e.g. the first two bits in every byte).
CSIT 220 (Blum)
15
CRC
• Cyclic Redundancy Check is better at
catching burst errors than checksums.
• The idea is the same, perform some
mathematical operation on the data, send
the result, have the receiver do the same
calculation and check that the same answer
is obtained.
CSIT 220 (Blum)
16
CRC (Cont.)
• In CRC the operation is somewhat like division
– If one thinks of the data as a large number, one
can divide it by another number N giving a
whole number answer and a remainder.
– The remainder could be any number between 0
and N-1.
– The problem here is that division is a fairly
difficult computation (more circuitry and a slow
process).
CSIT 220 (Blum)
17
CRC (Cont.)
• CRC uses a variation on division that while
mathematically abstract is very simple to
build a circuit for.
• The circuitry needs only a shift register and
some (2-input) XOR gates.
CSIT 220 (Blum)
18
Shift Register
• A register is a small piece of memory that
holds values.
• In addition to holding values, a shift register
performs a simple operation on the values;
it moves them to the left to to the right.
CSIT 220 (Blum)
19
Shift Register
0
1
0
1
0
1
1
1
1
0
1
0
1
1
1
0
0
1
0
1
1
1
0
1
1
0
1
1
1
0
1
0
Output
CSIT 220 (Blum)
Shift register
time
Input
20
How shift registers are used?
• Multiplication
• Adding floats
• Converting Parallel Data (the form inside
the computer) to Serial (the form sent over
transmission lines)
• Cyclic Redundancy Check (CRC)
CSIT 220 (Blum)
21
CRC: Shift register + XORs
Excluded Or gates
CSIT 220 (Blum)
22
CRC (Cont.)
• Again the 16-bit string might end up in any of 216
(65536) possible states, so you might expect that
CRC would catch errors 65535/65536  99.9985%
of the time, same as a 16-bit checksum.
• But CRC is better at detecting burst errors which
are more likely than purely random errors.
• The positions of the XORs are important in
determining what kinds of burst errors are
detected.
CSIT 220 (Blum)
23
CRC: Transmission Only
• The data must be serialized for a Cyclic
Redundancy check.
• This is fine for transmission error checking,
since the data was serialized for
transmission.
• However, serializing the data would waste a
lot of time if the data were in a parallel form
(as it is inside the computer).
CSIT 220 (Blum)
24
Topology
• The word “topology” is used here to convey
that we are not interested in the spatial
arrangement of the computers (where they
are located) but rather in how they are
connected.
– E.g. Is Computer A directly connected to
Computer B?
CSIT 220 (Blum)
25
Topologically Equivalent
A
A
B
C
D
B
C
D
CSIT 220 (Blum)
26
Point-to-Point
• One way to organize a network would be to
have a connection between every pair of
computers.
• Known as
– Point-to-point network
– Mesh network
– Fully connected network
CSIT 220 (Blum)
27
Point-to-Point
• This is fine for small networks, in fact it can
provide:
– Freedom in hardware choice
– Freedom in protocol choice
• Each pair can choose a protocol
– Security (communication channels are not
shared)
– Robustness (one broken cable does not bring
down the network)
CSIT 220 (Blum)
28
Point-to-Point (Cont.)
• The problem with this approach is that it
does not scale.
• Scaling refers to changing the size of
something.
• Something is said “to scale” if the change in
size requires a minimal amount of
modifications.
CSIT 220 (Blum)
29
Point-to-Point
CSIT 220 (Blum)
30
Number of Connections in a Pointto-Point Network
Number of Computers
CSIT 220 (Blum)
Number of connections
2
1
3
3
4
6
5
10
6
15
7
21
8
28
31
Adding another
• In the point-to-point approach, adding a 9th
computer to a network of eight requires
eight new connections, the new computer
must be connected to the eight old
computers.
• The computers will soon run out of ports
(slots/cards) for these connections and there
will be a massive tangle of wire.
CSIT 220 (Blum)
32
Star Topology
• In the star topology, the computers are
connected to a hub.
• Generally, a “hub” is the central part of a
wheel, where the spokes come together (the
part covered by a hubcap).
• A hub is a device that computers are
connected to so they can communicate.
CSIT 220 (Blum)
33
Star Topology (Fig. 8.3)
CSIT 220 (Blum)
34
Computers are not necessarily
arranged in a circle (topology)
Hub
CSIT 220 (Blum)
35
Star Topology (Cont.)
• The star topology is scalable, physically
adding a computer to a network requires
only connecting it to the hub.
• It is also robust, losing one connection does
not affect the entire network.
• (Losing power to the hub is another story.)
CSIT 220 (Blum)
36
Ring Topology
• Each computer in the network is connected
to two others.
• The connections form the perimeter of a
circle.
• If one followed the connections around, one
would visit each computer once and only
once before completing the round trip.
CSIT 220 (Blum)
37
Ring Topology (Fig. 8.4)
CSIT 220 (Blum)
38
Additions to the ring
• To add a computer to a pre-existing ring,
one of the previous connections must be
broken, and two new connections added.
• The ring topology is not very robust, if one
connection is disrupted, then the ring is
broken.
• The connection to the ring is designed so
that turning off a computer does not break
the ring.
CSIT 220 (Blum)
39
Bus topology
• The individual computers connect to a
common transmission path called the bus
(a.k.a. the backbone).
• Ideally, the information is placed on the bus
and is only read by the intended receiver.
• Much of the information moving around
inside a computer travels on buses.
CSIT 220 (Blum)
40
Bus Topology (Fig 8.5)
CSIT 220 (Blum)
41
Bus Topology (Cont.)
• To add a computer to such a network, the
computer must be connected to the bus.
• If a connection from a computer to bus is broken,
it does not necessarily affect the rest of the
network.
• If the bus connection is broken, the network is
divided into two parts.
– Actually it is worse than that, buses carry signals,
which are waves. And waves tend to reflect off of
surfaces (ends). The ends of the bus must be treated to
prevent the undesired reflection.
CSIT 220 (Blum)
42
Ethernet
• A fairly standard way to connect computers is
Ethernet.
– It originally used the bus topology.
• Strictly speaking Ethernet is the predecessor to the
IEEE’s 802.3 CSMA/CD local area network
standard.
• There are a few important differences; however,
the latter has also come to be known as Ethernet.
CSIT 220 (Blum)
43
“Ether” (Origin of the term)
• Water and sound waves require a medium,
some material through which the
disturbance moves
• Originally it was thought that
electromagnetic waves (light included) must
also have a medium, it was called “the
ether.”
CSIT 220 (Blum)
44
Ether (Origin of the term)
• Searches for the ether
(esp. by Michelson and
Morley) could not find it.
– The first two computers on
an ethernet were two Altos
called Michelson and
Morley.
• The absence of the ether
was important in
Einstein’s development of
relativity theory.
CSIT 220 (Blum)
45
ALOHA net
• Predecessor to Ethernet
• A radio-based communications system
connecting the Hawaiian islands, invented
by Norm Abramson.
• The first wireless packet-switching network.
CSIT 220 (Blum)
46
ALOHA net (Cont.)
• Occasionally two packets would be transmitted
simultaneously, they would interfere with each other
and the information would be corrupted.
• ALOHAnet had a protocol, in which the receiver
would perform an error check on each packet and
transmit an acknowledgment if the packet arrived
error free.
• If the transmitting computer did not receive such an
acknowledgment, it would retransmit after waiting a
random amount of time.
CSIT 220 (Blum)
47
Improving the protocol
• Bob Metcalfe improved upon this protocol.
– Metcalfe (MIT, Xerox) eventually started 3Com:
Computer Communication Compatibility.
• Before sending a packet, the transmitter “listens”
for any traffic on the line and only transmits if
there is none.
• Of course, two distance transmitters might “sense”
a quiet or idle carrier and decide to transmit
packets simultaneously or nearly simultaneously
CSIT 220 (Blum)
48
Collisions
CSIT 220 (Blum)
49
Collision: If a body meet a body
• If two packets are sent on an Ethernet
simultaneously, it is known as a “collision.”
• When a collision is detected, the packets involved
are discarded.
• Each transmitter waits a random amount of time
chosen from a certain interval and retransmits.
• If a second collision occurs, the process is
repeated but the interval is doubled in size.
• This process, known as binary exponential
backoff, makes it very unlikely the packets will
continue to collide.
CSIT 220 (Blum)
50
CSMA/CD
• This protocol goes by the name Carrier
Sense Multiple Access/Collision Detect
(CSMA/CD).
• Carrier Sense: waits for line to be idle.
• Multiple Access: various nodes share a
common transmission line.
• Collision Detect: simultaneously
transmitted packets are detected, discarded
and retransmitted.
CSIT 220 (Blum)
51
Ethernet (Cont.)
• What has come to be called Ethernet is the
technology most often used for LANs.
• It uses a bus topology.
– More about logical topology versus physical topology
another time
• Ethernet was originally developed by Xerox and
then extended by DEC, Intel and Xerox (DIX
Ethernet).
• It was then specified in a standard, IEEE 802.3.
CSIT 220 (Blum)
52
IEEE
• Institute of Electrical and Electronics
Engineers
• Self-described as “the world's largest
technical professional society — promoting
the development and application of
electrotechnology and allied sciences for the
benefit of humanity, the advancement of the
profession, and the well-being of our
members."
CSIT 220 (Blum)
53
IEEE (Cont.)
• It is a professional organization for electrical and
electronic engineers.
• They hold meetings, publish journals and so on.
• Their importance here is that they also develop
and promote standards, both national and
international.
• The importance of standards cannot be overemphasized.
CSIT 220 (Blum)
54
Manchester encoding
• One aspect of the standard is the way in which bits
are represented.
• Recall in the RS232 standard, the bit value is
represented by the voltage’s level (high for 0, low
for 1).
• But Ethernet uses Manchester encoding in which a
rising voltage (in the middle of a time interval)
corresponds to a 1 and a falling voltage
corresponds to a 0.
• The hardware is said to be “edge triggered” — it
detects changes more easily than levels.
CSIT 220 (Blum)
55
Timing
• Pro: Because the signal is guaranteed to vary at
least once each interval, it helps in maintaining the
timing between transmitter and receiver.
• Pro: Because the important part of the signal is in
the middle of the interval, other parts of the signal
can effectively be ignored and noise during those
times is irrelevant.
• Con: The signal has to be able to change at a rate
twice as fast as the information rate (so one’s not
using the full capacity of the channel).
CSIT 220 (Blum)
56
Manchester encoding
One interval
Rising in middle of interval
CSIT 220 (Blum)
57
Wiring an Ethernet
• A LAN using Ethernet generally uses
coaxial cable or special grades of twisted
pair wires.
• The most commonly installed Ethernet
systems today are called 10BASE-T and
provide transmission speeds up to 10 Mbps.
– M stands for mega (1,000,000)
CSIT 220 (Blum)
58
Ethernet (Cont.)
• Fast Ethernet or 100BASE-T provides
transmission speeds up to 100 megabits per
second and is typically used for LAN backbone
systems, supporting workstations with 10BASE-T
cards.
• Gigabit Ethernet provides an even higher level of
backbone support at 1000 megabits per second (1
gigabit or 1 billion bits per second).
CSIT 220 (Blum)
59
10BASE-T
• One of several physical media standardized
for use in Ethernet LANs.
• Is somewhat like ordinary telephone twisted
pair, but has more twists because the signals
are more sensitive to interference.
• Supports 10 Mbps transmission speed.
CSIT 220 (Blum)
60
10BASE-T
• The "10" in the media type designation
refers to the transmission speed of 10 Mbps.
• The "BASE" refers to baseband signaling,
which means that only Ethernet signals are
carried on the medium.
• The "T" represents twisted-pair.
CSIT 220 (Blum)
61
Token Ring Network
• A LAN organized in the ring (or possibly
star) topology.
• The protocol used is a “token-passing”
scheme.
• The token gives a transmitter permission to
transmit, thereby preventing packet
collisions.
CSIT 220 (Blum)
62
Token ring protocol
•
•
•
A special frame called the token is passed
around the ring, a given node is allowed to
transmit when it “has the token.”
If a node has no data to transmit, it simply
passes the token on to the next computer.
If it has data to transmit, it inserts that data into
the frame along with address information and
other protocol information and then alters the
frame so that the next computer does not have
permission to transmit.
CSIT 220 (Blum)
63
Token ring protocol (Cont.)
• If a node receives a frame with data, it looks at the
address information. If the destination does not
match the computer’s address, it simply passes the
frame to the adjacent node. If the destination
matches the computer’s address, it copies the data,
but also passes it on (perhaps adding some
acknowledgement).
• The frame eventually reaches its point of origin,
the original transmitter removes the packet and
puts a token frame onto the ring, giving
permission to the next node to transmit.
CSIT 220 (Blum)
64
Token ring (Cont.)
•
•
•
Tokens can also be used on bus-organized
LANs.
The standard token ring protocol IEEE
802.5.
The Fiber Distributed-Data Interface
(FDDI) also uses a token ring protocol.
CSIT 220 (Blum)
65
Other references
• http://www.whatis.com
• http://www.webopedia.com
• Understanding Data Communications and
Networks, William Shay
• Computer Dictionary, Mitchell Shnier
• http://www.pbs.org/opb/nerds2.0.1/
CSIT 220 (Blum)
66