Module 2 CCN
Module 2 CCN
Module 2 CCN
Introduction
To
Data-Link
Layer
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
9-1 INTRODUCTION
9.2
Figure 9.1: Communication at the data-link layer
Only one d/l layer
involved at the source
and destination, but two
d/l layers are involved at
each router
9.3
9.9.1 Nodes and Links
Figure is a simple representation of links and nodes when the path of the data unit is
only six nodes. The first node is the source host, last node is the destination host. The
other four nodes are four routers. 1,3,5 links represent the three LANs and 2,4
represent the two WANs
9.5
Figure 9.3: A communication with only three nodes
The datagram received by d/l layer of source host is encapsulated in a
frame. The frame is logically transported from the source host to the
router. The frame is decapsulate at the d/l layer of the router and
encapsulated at the another frame. The new frame is logically transported
from the router to the destination host. Though only 2 d/l layers are
shown router actually has 3 d/l layers because it is connected to 3
physical links.
9.6
9.9.2 Services
9.7
Services provided by Data link layer
Framing- d/l layer has encapsulate /decapsulate
datagram
Flow control- let the receiving d/l layer drop the frames if
its buffer is full. Or let receiving d/l layer send a feed back to the
sending d/l layer to ask it to stop or slow down. In t/l layer flow
control occurs at higher degree of importance
Error control- A frame is susceptible to error. It needs to
be detected, corrected at Rx and discarded or retransmitted at
Tx. To detect (damaged, lost, duplicate) frames
Congestion control- most d/l layer protocol do not
directly use a congestion control , in general it is considered an
issue in n/w layer or t/l layer because of its end to end nature.
1.8
9.9.3 Two Categories of Links
Although two nodes are physically connected by a
transmission medium such as cable or air, we need to
remember that the data-link layer controls how the
medium is used.
9.10
Figure 9.3: Dividing the data-link layer into two sublayers
9.11
5-4 LINK-LAYER ADDRESSING
9.12
Figure 2.19 Physical
addresses
2.13
•Logical Address:
A universal addressing system is needed in which each host
can be identified uniquely, regardless of the underlying physical n/w
•Currently a 32 bit address is used
IP
addresses
2.14
9.2.2 ARP
9.15
Figure 9.6: Position of ARP in TCP/IP protocol suite
9.16
Figure 9.7: ARP operation
9.17
Figure 9.8: ARP packet
9.18
Example 9.4
A host with IP address N1 and MAC address L1 has a
packet to send to another host with IP address N2 and
physical address L2 (which is unknown to the first host).
The two hosts are on the same network. Figure 9.9 shows
the ARP request and response messages.
9.19
Figure 9.9: Example 9.4
9.20
Chapter 11
Data Link
Control
(DLC)
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
11-1 DLC SERVICES
11.22
111.11.1 Framing
11.23
Figure 111.1: A frame in a character-oriented protocol
11.24
Figure 111.2: Byte stuffing and unstuffing
11.27
111.11.2 Flow and Error Control
11.28
Figure 111.5: Flow control at the data link layer
11.29
If the receiving node cannot process and deliver the
packet to its network at the same rate that the frames
arrive, it become overwhelmed with frames. Flow control
can be the feedback from the receiving node to the
sending node to stop or slow down pushing frames.
1.30
Example 111.1
The above discussion requires that the consumers
communicate with the producers on two occasions: when
the buffer is full and when there are vacancies. If the two
parties use a buffer with only one slot, the communication
can be easier. Assume that each data-link layer uses one
single memory slot to hold a frame. When this single slot in
the receiving data-link layer is empty, it sends a note to the
network layer to send the next frame.
11.31
111.11.3 Connection
11.33
Figure : FSMs ( Finite state machine)- the behavior of a d/l can be better
shown as FSM
11.34
Simple Protocol
Our first protocol is a simple protocol
11.35
Figure 111.8: FSM for the simple protocol
11.36
Figure 111.9: Flow diagram for Example 111.2
11.37
Stop-and-Wait Protocol
11.38
Figure : Stop-and-wait Protocol
11.40
Example 111.3
Figure shows an example. The first frame is sent and
acknowledged. The second frame is sent, but lost. After
time-out, it is resent. The third frame is sent and
acknowledged, but the acknowledgment is lost. The frame is
resent. However, there is a problem with this scheme. The
network layer at the receiver site receives two copies of the
third packet, which is not right. we can correct this problem
using sequence numbers and acknowledgment numbers.
11.41
Figure 111.12: Flow diagram for Example
11.42
Example 111.4
Figure 11.13 shows how adding sequence numbers and
acknowledgment numbers can prevent duplicates. The first
frame is sent and acknowledged. The second frame is sent,
but lost. After time-out, it is resent. The third frame is sent
and acknowledged, but the acknowledgment is lost. The
frame is resent.
11.43
Figure 111.13: Flow diagram for Example 111.4
11.44
Piggybacking
11.45
Chapter 12
Media
Access
Control
(MAC)
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 5: Outline
12.3 CHANNELIZATION
Figure 12.1: Taxonomy of multiple-access protocols
12.48
12-1 RANDOM ACCESS
12.52
Figure 12.2: Frames in a pure ALOHA network
12.53
Figure 12.3: Procedure for pure ALOHA protocol
12.54
Example 12. 1
The stations on a wireless ALOHA network are a maximum
of 600 km apart. If we assume that signals propagate at
3 × 108 m/s, we find Tp = (600 × 103) / (3 × 108) = 2 ms. For
K = 2, the range of R is {0, 1, 2, 3}. This means that TB can
be 0, 2, 4, or 6 ms, based on the outcome of the random
variable R.
12.55
Figure 12.4: Vulnerable time for pure ALOHA protocol
12.56
Example 12.2
A pure ALOHA network transmits 200-bit frames on a
shared channel of 200 kbps. What is the requirement to
make this frame collision-free?
Solution
Average frame transmission time Tfr is 200 bits/200 kbps or
1 ms. The vulnerable time is 2 × 1 ms = 2 ms. This means
no station should send later than 1 ms before this station
starts transmission and no station should start sending
during the period (1 ms) that this station is sending.
12.57
Example 12. 3
A pure ALOHA network transmits 200-bit frames on a
shared channel of 200 kbps. What is the throughput if the
system (all stations together) produces
a. 1000 frames per second?
b. 500 frames per second?
c. 250 frames per second?
12.58
Example 12. 3
A pure ALOHA network transmits 200-bit frames on a
shared channel of 200 kbps. What is the throughput if the
system (all stations together) produces
a. 1000 frames per second?
b. 500 frames per second?
c. 250 frames per second?
Solution
The frame transmission time is 200/200 kbps or 1 ms.
a. If the system creates 1000 frames per second, or 1 frame
per millisecond, then G = 1. In this case S = G × e−2G =
0.135 (13.5 percent). This means that the throughput is
1000 × 0.135 = 135 frames. Only 135 frames out of 1000
will probably survive.
12.59
Example 12. 3 (continued)
b. If the system creates 500 frames per second, or 1/2 frames
per millisecond, then G = 1/2. In this case S = G × e−2G
= 0.184 (18.4 percent). This means that the throughput is
500 × 0.184 = 92 and that only 92 frames out of 500 will
probably survive. Note that this is the maximum
throughput case, percentage-wise.
12.60
• Slotted ALOHA:
• To improve efficiency of pure ALOHA
• Divide the time into slots
• Force the station to send only at the beginning of the time slot
• If it misses it must wait until the beginning of the next time slots
• Still possibility of collision if two stations try to snd at the beginning of the same
time slot
• Vulnerable time= Tfr
• The throughput of slotted ALOHA is S= G x e –G
• The maximum throughput Smax =0.368 when G=1
Figure 12.5: Frames in a slotted ALOHA network
12.62
Figure 12.6: Vulnerable time for slotted ALOHA protocol
12.63
Example 12. 4
A slotted ALOHA network transmits 200-bit frames using a
shared channel with a 200-kbps bandwidth. Find the
throughput if the system (all stations together) produces
Solution
This situation is similar to the previous exercise except that
the network is using slotted ALOHA instead of pure
ALOHA. The frame transmission time is 200/200 kbps or 1
ms.
12.64
Example 12. 4 (continued)
a) In this case G is 1. So S = G × e−G = 0.368 (36.8
percent). This means that the throughput is 1000 ×
0.0368 = 368 frames. Only 368 out of 1000 frames will
probably survive. Note that this is the maximum
throughput case, percentage-wise.
b) Here G is 1/2. In this case S = G × e−G = 0.303 (30.3
percent). This means that the throughput is 500 × 0.0303
= 1512. Only 151 frames out of 500 will probably
survive.
c) Now G is 1/4. In this case S = G × e−G = 0.195 (19.5
percent). This means that the throughput is 250 × 0.195
= 49. Only 49 frames out of 250 will probably survive.
12.65
12.12.2 CSMA
12.66
• Carrier Sense Multiple Access (CSMA)
• The chance of collision can be reduced if a station senses the medium
before trying to use it.
• Each station "sense before transmit" or "listen before talk.“
• CSMA can reduce the possibility of collision, but it cannot eliminate
it.
• The possibility of collision still exists because of propagation
delay(first bit)
Figure 12.7: Space/time model of a collision in CSMA
12.68
Figure 12.8: Vulnerable time in CSMA
12.69
• Persistence Methods
• What should a station do if the channel is busy?
• What should a station do if the channel is idle?
• Three methods : the 1-persistent method, the non persistent
method, and the p-persistent method.
• 1-Persistent :
• In this method, after the station finds the line idle, it sends
its frame immediately (with probability 1).
• This method has the highest chance of collision because
two or more stations may find the line idle and send their
frames immediately.
• Non persistent ; In the non persistent method, a station that
has a frame to send senses the line.
• If the line is idle, it sends immediately. If the line is not
idle, it waits a random amount of time and then senses the
line again.
• The non persistent approach reduces the chance of
collision because it is unlikely that two or more stations
will wait the same amount of time and retry to send
simultaneously.
• this method reduces the efficiency of the network because
the medium remains idle when there may be stations with
frames to send.
• p-Persistent:
• combines the advantages of the other two strategies. It
reduces the chance of collision and improves efficiency.
• In this method, after the station finds the line idle it follows
these steps:
• 1. With probability p, the station sends its frame.
• 2. With probability q = 1 - p, the station waits for the
beginning of the next time slot and checks the line again.
• a. If the line is idle, it goes to step 1.
• b. If the line is busy, it acts as though a collision has
occurred and uses the backoff procedure.
Figure 12.9: Behavior of three persistence methods
Nonpersistent-senses the line; idle: sends immediately; not idle: waits random amount
of time and senses again
p-Persistent-the channel has time slots with duration equal to or greater than max
propagation time
12.73
Figure 12.10: Flow diagram for three persistence methods
12.74
12.12.3 CSMA/CD
12.75
• Carrier Sense Multiple Access with Collision Detection
(CSMA/CD)
• (CSMA/CD) augments the algorithm to handle the collision.
• a station monitors the medium after it sends a frame to see if the
transmission was successful.
• If so, the station is finished. If, there is a collision, the frame is
sent again.
• Looking at the figure, we see that A transmits for the duration
• t4 – t1;
• C transmits for the duration t3 - t2'
Figure 12.11: Collision of the first bits in CSMA/CD
12.77
Figure 12.12: Collision and abortion in CSMA/CD
12.78
Example 12. 5
A network using CSMA/CD has a bandwidth of 10 Mbps. If
the maximum propagation time (including the delays in the
devices and ignoring the time needed to send a jamming
signal, as we see later) is 25.6 μs, what is the minimum size
of the frame?
Solution
The minimum frame transmission time is Tfr = 2 × Tp = 51.2
μs. This means, in the worst case, a station needs to transmit
for a period of 51.2 μs to detect the collision. The minimum
size of the frame is 10 Mbps × 51.2 μs = 512 bits or 64
bytes. This is actually the minimum size of the frame for
Standard Ethernet, as we will see later in the chapter.
12.79
Figure 12.13: Flow diagram for the CSMA/CD
12.80
Figure 12.14: Energy level during transmission, idleness, or collision
12.82
• Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA)
• CSMA/CD is that a station needs to be able to receive while transmitting to detect a
collision.
• When there is no collision, the station receives one signal: its own signal.
• When there is a collision, the station receives two signals: its own signal and the
signal transmitted by a second station.
• To distinguish between these the signal from the second station needs to add a
significant amount of energy to the one created by the first station.
• In a wired network, the received signal has almost the same energy as the sent signal
because either the length of the cable is short or there are repeaters that amplify the
energy between the sender and the receiver.
• This means that in a collision, the detected energy almost doubles.
• in a wireless network, much of the sent energy is lost in transmission. The received
signal has very little energy. Therefore, a collision may add only 5 to 10 percent
• additional energy. This is not useful for effective collision detection.
• We need to avoid collisions on wireless networks because they cannot be detected.
• Carrier sense multiple access with collision avoidance (CSMAlCA) was invented for
this
• network. Collisions are avoided through the use of CSMAICA's three strategies: the
interframe
Figure 12.15: Flow diagram for CSMA/CA
12.84
Figure 12.16: Contention window
Interframe space(IFS)- when an idle channel is found the station does not
send immediately , it wais for a period of time called IFS. After IFS if the
channel is still idle then the station can send , but still needs to wait a time
equal to the contention window.
Contention window. : is an amount of time divided into slots. A station
chooses a random number of slots as its wait time. The slots changes
according to binary exponential backoff strategy. Station needs to sense the
channel after each time slot
Acknowledgement: the positive acknowledgement and time our timer
guarantee the receiver has received the frame.
12.85
Figure 12.17: CSMA/CA and NAV
12.86
Chapter 13
Wired LANs:
Ethernet
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 5: Outline
13.89
13.13.1 IEEE Project 802
In 1985, the Computer Society of the IEEE started
a project, called Project 802, to set standards to
enable intercommunication among equipment
from a variety of manufacturers.
13.91
13.13.2 Ethernet Evolution
13.92
Figure 13.2 : Ethernet evolution
13.93
13-2 STANDARD ETHERNET
13.94
13.2.1 Characteristics
some characteristics of the Standard Ethernet.
Provides a connectionless and Unreliable service
No connection est. or termination.
Rx may not be ready which may result dropping frames.
IP also uses the service of Ethernet, so it is also connectionless.
If t/l is also connectionless like UDP then the frame is lost.
If it is TCP Tx does not receive ack it sends again.
Ethernet is also unreliable like IP and UDP. If a frame is
corrupted during the transmission Rx drops the fame silently and
it is the duty of high level protocols to find out about it.
13.95
Figure 13.3: Ethernet frame
Frame Format
The Ethernet frame contains seven fields: preamble, SFD, DA, SA, length
or type of protocol data unit (PDU), upper-layer data, and the CRC.
13.98
13.2.2 Addressing
13.99
Figure 13.4: Unicast and multicast addresses
13.100
Example 13.2
Define the type of the following destination addresses:
.4A:30:10:21:10:1A
.47:20:1B:2E:08:EE
.FF:FF:FF:FF:FF:FF
Solution
To find the type of the address, we need to look at the
second hexadecimal digit from the left. If it is even, the
address is unicast. If it is odd, the address is multicast. If all
digits are Fs, the address is broadcast. Therefore, we have
the following:
13.101
Example 13.2 (continued)
a. This is a unicast address because A in binary is 1010
(even).
b. This is a multicast address because 7 in binary is 0111
(odd).
c. This is a broadcast address because all digits are Fs in
hexadecimal.
13.102
Figure 13.5: Implementation of standard Ethernet
13.103
13.2.3 Access Method
13.104
13.2.4 Efficiency of Standard Ethernet
13.105
Example 13.3
In the Standard Ethernet with the transmission rate of 10
Mbps, we assume that the length of the medium is 2500 m
and the size of the frame is 512 bits. The propagation speed
of a signal in a cable is normally 2 × 108 m/s.
13.107
Table 13.1: Summary of Standard Ethernet implementations
13.108
Figure 13.6: Encoding in a Standard Ethernet
13.109
Figure 13.7: 10Base5 implementation
13.110
10Base5: thick Ethernet, or Thicknet.
The nickname derives from the size of the cable, which is roughly the size
of a garden hose and too stiff to bend with your hands.
10 Base 5 was the first Ethernet specification to use a bus topology with
an external transceiver (transmitter/receiver) connected via a tap to a thick
coaxial cable.
.
The maximum length of the coaxial cable must not exceed 500 m
13.111
Figure 13.8: 10Base2 implementation
13.112
10Base2: Thin Ethernet
The second implementation is called 10Base2, thin Ethernet,
or Cheaper net.
13.114
The third implementation is called 10 Base-T or twisted-pair Ethernet.
Note that two pairs of twisted cable create two paths (one for sending and
one for receiving) between the station and the hub.
13.115
Figure 13.10: 10Base-F implementation
13.116
Chapter 15
Wireless
LANs
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
15-1 INTRODUCTION
15.118
15.15.1 Architectural Comparison
15.119
Figure 15.1: Isolated LANs: wired versus wireless
15.120
Figure 15.2: Connection of a wired LAN and a wireless LAN to other
networks
15.121
15.15.2 Characteristics
15.122
Attenuation
The strength of electromagnetic signals decreases rapidly because the signal
disperses in all directions; only a small portion of it reaches the receiver. The
situation becomes worse with mobile senders that operate on batteries and
normally have small power supplies.
Interference
Another issue is that a receiver may receive signals not only from the intended
sender, but also from other senders if they are using the same frequency band.
Multipath Propagation
A receiver may receive more than one signal from the same sender because
electromagnetic waves can be reflected back from obstacles such as walls, the
ground, or objects. The result is that the receiver receives some signals at
different phases (because they travel different paths). This makes the signal less
recognizable.
Error
With the above characteristics of a wireless network, we can expect that errors
and error detection are more serious issues in a wireless network than in a wired
network. If we think about the error level as the measurement of signal-to-noise
ratio (SNR), we can better understand why error detection and error correction
and retransmission are more important in a wireless network. SNR measures the
ratio of good stuff to bad stuff (signal to noise). If SNR is high, it means that the
signal is stronger than the noise (unwanted signal), so we may be able to convert
the signal to actual data. On the other hand, when SNR is low, it means that the
signal is corrupted by the noise and the data cannot be recovered.
15.15.3 Access Control
15.124
Figure 15.3: Hidden station problem
15.125
Assume that station B is sending data to station A. In the
middle of this transmission,
station C also has data to send to station A. However, station
C is out of
B’s range and transmissions from B cannot reach C.
Therefore C thinks the
medium is free. Station C sends its data to A, which results in
a collision at A
because this station is receiving data from both B and C. In
this case, we say that
stations B and C are hidden from each other with respect to
A.