Вы находитесь на странице: 1из 155

CHAPTER 1

PRACTICE SET
Questions
Q1-1. The five components of a data communication system are the sender, the
receiver, the transmission medium, the message, and the protocol.

Q1-3. Advantages of a multipoint over a point-to-point configuration (type of con-


nection) include ease of installation and low cost.

Q1-5. We can divide line configuration in two broad categories:

a. Point-to-point: mesh, star, and ring.


b. Multipoint: bus

Q1-7. We give an advantage for each of four network topologies:

a. Mesh: secure
b. Bus: easy installation
c. Star: robust
d. Ring: easy fault isolation

Q1-9. The general factors are size, distances (covered by the network), structure,
and ownership.

Q1-11. A protocol defines what is communicated, in what way and when. This pro-
vides accurate and timely transfer of information between different devices on
a network.

Q1-13. Each LAN should be connected to (n − 1) LANs, which means that we will
have n × (n − 1) connections. However, if each connection can be used in both
directions, we need only [n × (n − 1)]/2 connections.

1
2

Q1-15. The telephone company acts as an ISP. The connection from the resident to
the telephone company is a point-to-point access WAN that connects the
premises to the Internet. At the same time, the telephone company needs to
provide the necessary services such as e-mail.

Q1-17. An Internet draft is a working document with no official status and a six-
month lifetime; an Internet draft may become a proposed standard after six
months if it has received enough attention in the Internet community.

Q1-19. The IETF is responsible for identifying operational problems and recom-
mending solutions; the IRTF focuses on long-term research topics.

Problems
P1-1. Unicode uses 32 bits to represent a symbol or a character. We can define 232
different symbols or characters.

P1-3.

a. Cable links: n (n – 1) / 2 = (6 × 5) / 2 = 15
b. Number of ports: (n – 1) = 5 ports needed per device

P1-5. This is a LAN. The Ethernet hub creates a LAN as we will see in Chapter 13.

P1-7. In a bus topology, no station is in the path of the signal. Unplugging a station
has no effect on the operation of the rest of the network.

P1-9. In this case, the communication is only between a caller and the callee. A ded-
icated line is established between them. The connection is point-to-point.
CHAPTER 2

PRACTICE SET

Questions
Q2-1. To make the communication bidirectional, each layer needs to be able to pro-
vide two opposite tasks, one in each direction.

Q2-3. The router is involved in:

a. three physical layers,


b. three data-link layers,
c. and only one network layer.

Q2-5.

a. At the application layer, the unit of data is a message.


b. At the network layer, the unit of data is a datagram.
c. At the data-link layer, the unit of data is a frame.

Q2-7. A user datagram is a transport-layer data unit. It decapsulates a data unit going
to the application layer. In this case, the data unit is a message.

Q2-9. We mentioned HTTP, FTP, SMTP, SNMP, TELNET, SSH, and DNS.

Q2-11.

a. At the application layer, we normally use a name to define the destination-


computer name and the name of the file we need to access. An example is
something@somewhere.com.
b. At the network layer, we use two logical addresses (source and destination)
to define the source and destination computers. These addresses are unique
universally.
c. At the data-link layer, we use two link-layer addresses (source and destina-
tion) to define the source and destination connections to the link.

1
2

Q2-13. The application layer is the top layer in the suite; it does not provide services
to any layer, which means multiplexing/demultiplexing does not exist for this
layer.

Q2-15. We do not need a router in this case because a router is needed when there is
more than one path between the two hosts; the router is responsible for choos-
ing the best path at each moment.

Problems
P2-1. The services provided in part a and part b are the opposite of each other.

a. Layer 1 takes the ciphertext from layer 2, inserts (encapsulates) it in an


envelope and sends it.
b. Layer 1 receives the mail, removes (decapsulates) the ciphertext from the
envelope and delivers it to layer 2.

P2-3. In 10 years, the number of hosts becomes about six times (1.2010 ≈ 6.19) the
number in 2010. This means the number of hosts connected to the Internet is
more than three billion.

P2-5. The advantage of using large packets is less overhead. When using large pack-
ets, the number of packets to be sent for a huge file becomes small. Since we
are adding three headers to each packet, we are sending fewer extra bytes than
in the case in which the number of packets is large. The disadvantage mani-
fests itself when a packet is lost or corrupted during the transmission; we need
to resend a large amount of data.

P2-7.

a. User datagrams are created at the transport layer.


b. The data-link layer is responsible for handling frames between adjacent
nodes.
c. The physical layer is responsible for transforming bits to electromagnetic
signals.

P2-9. The following shows the situation. If we think about multiplexing as many-to-
one and demultiplexing as one-to-many, we have demultiplexing at the source
3

node and multiplexing at the destination node in the data-link layer. However,
some purists call these two inverse multiplexing and inverse demultiplexing.

FTP HTTP DNS SNMP FTP HTTP DNS SNMP

Multiplexing TCP UDP TCP UDP Demultiplexing

Demultiplexing IP IP Multiplexing

L1 L2 L3 L1 L2 L3

a. At the source node b. At the destination node

P2-11. The following shows the layers. Note that we have not shown the security
checking that you need to pass through because it does not have the counter-
part when you arrive. It must be included in baggage/checking layer.

Source/destination Source/destination
airport airport
Baggage Baggage
checking/claiming checking/claiming
Boarding/unboarding Boarding/unboarding

Takeoff/Landing Takeoff/Landing

Flying

P2-13. The only two layers that need to be changed are the data-link layer and the
physical layer. The new hardware and software need to be installed in all host,
routers, and link-layer switches. As long as the new data-link layer can encap-
sulate and decapsulate datagrams from the network layer, there is no need to
change any protocol in the upper three layers. This is one of the characteristics
of the protocol layering.
4

P2-15. The following shows the layers and the flow of data. Note that each host is
involved in five layers, each switch in two layers, and each router in three lay-
ers.

West coast office East coast office

R1
Point-to-point R2
WAN
Router Router

5 5
4 4
3 3 3 3 3 3
2 2 2 2 2 2 2 2 2 2
1 1 1 1 1 1 1 1 1 1
Host Switch Router Router Switch Host
CHAPTER 3

PRACTICE SET

Questions
Q3-1. The period of a signal is the inverse of its frequency and vice versa: T = 1/f
and f = 1/T.

Q3-3. Fourier series gives the frequency domain of a periodic signal; Fourier analy-
sis gives the frequency domain of a nonperiodic signal.

Q3-5. Baseband transmission means sending a digital or an analog signal without


modulation using a low-pass channel. Broadband transmission means to mod-
ulate signal using a band-pass channel.

Q3-7. The Nyquist theorem defines the maximum bit rate of a noiseless channel.

Q3-9. A fiber-optic cable uses light (very high frequency). Since f is very high, the
wavelength, which is λ = c / f, is very low.

Q3-11. The frequency domain of a voice signal is normally continuous because voice
is a nonperiodic signal.

Q3-13. This is baseband transmission because no modulation is involved.

Q3-15. This is broadband transmission because it involves modulation.

Problems
P3-1.

a. T=1/f = 1 / (24 Hz) = 0.0417 s = 41.7 ms


b. T=1/f = 1 / (8 MHz) = 0.000000125 s = 0.125 ms
c. T=1/f = 1 / (140 kHz) = 7.14 × 10–6 s = 7.14 ms

1
2

P3-3.

a. 90 degrees (π/2 radians)


b. 0 degrees (0 radians)
c. 90 degrees (π/2 radians) (Note that it is the same wave as in part a.)

P3-5. We know the bandwidth is 2000. The highest frequency must be 100 + 2000 =
2100 Hz. See below:

20

5
Frequency
100 2100
Bandwidth = 2100  100 = 2000

P3-7.

a. bit rate = 1/ (bit duration) = 1 / (0.001 s) = 1000 bps = 1 Kbps


b. bit rate = 1/ (bit duration) = 1 / (2 ms) = 500 bps
c. bit rate = 1/ (bit duration) = 1 / (20 μs/10) = 1 / (2 μs) = 500 Kbps

P3-9. There are 8 bits in 16 ns. Bit rate is 8 / (16 × 10−9) = 0.5 × 109 = 500 Mbps

P3-11. The bandwidth is 5 × 5 = 25 Hz.

P3-13. The signal is nonperiodic, so the frequency domain is made of a continuous


spectrum of frequencies as shown below:

Amplitude
30 volts

10 volts 10 volts
Frequency
10 KHz 20 KHz 30 KHz

P3-15. We can calculate the attenuation as shown below:

dB = 10 log10 (90 / 100) = –0.46 dB

P3-17. The total gain is 3 × 4 = 12 dB. To find how much the signal is amplified, we
can use the following formula:
3

12 = 10 log (P2 /P1) → log (P2 /P1) = 1.2 → P2 /P1 = 101.2 = 15.85

The signal is amplified almost 16 times.

P3-19. 480 s × 300,000 km/s = 144,000,000 km

P3-21. We use the Shannon capacity C = B log2 (1 + SNR)

C = 4,000 log2 (1 + 1,000) ≈ 40 Kbps

P3-23. The file contains 2,000,000 × 8 = 16,000,000 bits.

a. With a 56-Kbps channel, it takes 16,000,000/56,000 = 289 s ≈ 5 minutes.


b. With a 1-Mbps channel, it takes 16,000,000/1,000,000 = 16 s.

P3-25. We have

SNR = (200 mW) / (10 × 2 × μW) = 10,000


SNRdB = 10 log10 SNR = 10 log1010000 = 40

P3-27. We can approximately calculate the capacity as

a. C = B × (SNRdB /3) = 20 KHz × (40 /3) = 267 Kbps


b. C = B × (SNRdB /3) = 200 KHz × (4 /3) = 267 Kbps
c. C = B × (SNRdB /3) = 1 MHz × (20 /3) = 6.67 Mbps

P3-29. We can use the approximate formula

C = B × (SNRdB /3) or SNRdB = (3 × C) / B


We can say that the minimum of SNRdB is
SNRdB = 3 × 100 Kbps / 4 KHz = 75
This means that the minimum
SNR = 10 SNRdB/10 = 107.5 ≈ 31,622,776
P3-31. The bit duration is the inverse of the bandwidth.We have

(bit length) = (propagation speed) ´ (bit duration)

a. Bit length = (2 ×108 m) × [(1 / (1 Mbps)] = 200 m. This means a bit occu-
pies 200 meters on a transmission medium.
b. Bit length = (2 ×108 m) × [(1 / (10 Mbps)] = 20 m. This means a bit occu-
pies 20 meters on a transmission medium.
4

c. Bit length = (2 ×108 m) × [(1 / (100 Mbps)] = 2 m. This means a bit occu-
pies 2 meters on a transmission medium.

P3-33. We have Latency = Delaypr + Delayqu + Delaytr + Delaypg

Delaypr = 10 × 1 μs = 10 μs // Processing delay


Delayqu = 10 × 2 μs = 20 μs // Queuing delay
Delaytr = 5,000,000 / (5 Mbps) = 1 s // Transmission delay
Delaypg = (2000 Km) / (2 × 108) = 0.01 s // Propagation delay

This means
Latency = 10 μs + 20 μs + 1s + 0.01 s ≈ 1.01 s

The transmission time is dominant here because the packet size is huge.
CHAPTER 4

PRACTICE SET

Questions
Q4-1. The three different techniques described in this chapter are line coding, block
coding, and scrambling.

Q4-3. The data rate defines the number of data elements (bits) sent in 1s. The unit is
bits per second (bps). The signal rate is the number of signal elements sent in
1s. The unit is the baud.

Q4-5. When the voltage level in a digital signal is constant for a while, the spectrum
creates very low frequencies, called DC components, that present problems
for a system that cannot pass low frequencies.

Q4-7. In this chapter, we introduced unipolar, polar, bipolar, multilevel, and multi-
transition coding.

Q4-9. Scrambling, as discussed in this chapter, is a technique that substitutes long


zero-level pulses with a combination of other levels without increasing the
number of bits.

Q4-11. In parallel transmission we send data several bits at a time. In serial transmis-
sion we send data one bit at a time.

Problems
P4-1. We use the formula s = c × N × (1/r) for each case. We let c = 1/2.

a. r = 1 → s = (1/2) × (1 Mbps) × 1/1 = 500 kbaud


b. r = 1/2 → s = (1/2) × (1 Mbps) × 1/(1/2) = 1 Mbaud
c. r = 2 → s = (1/2) × (1 Mbps) × 1/2 = 250 Kbaud
d. r = 4/3 → s = (1/2) × (1 Mbps) × 1/(4/3) = 375 Kbaud

1
2

P4-3. See the following figure. Bandwidth is proportional to (3/8)N which is within
the range in Table 4.1 (B = 0 to N) for the NRZ-L scheme.

Average Number of Changes = (0 + 0 + 8 + 4) / 4 = 3 for N = 8


B (3 / 8) N
Case a Case b

0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

0 1 0 1 0 1 0 1 0 0 1 1 0 0 1 1

Case c Case d

P4-5. See the following figure. Bandwidth is proportional to (12.5 / 8)N which is
within the range in Table 4.1 (B = N to B = 2N) for the Manchester scheme.

Average Number of Changes = (15 + 15+ 8 + 12) / 4 = 12.5 for N = 8

B (12.5 / 8) N

Case a Case b
1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0

0 1 0 1 0 1 0 1 0 0 1 1 0 0 1 1

Case c Case d
3

P4-7. See the following figure. B is proportional to (5.25 / 16)N which is inside
range in Table 4.1 (B = 0 to N/2) for 2B/1Q.

Average Number of Changes = (0 + 7 + 7 + 7) / 4 = 5.25 for N = 16

B (5.25 / 8) N

Case a Case b
00 00 00 00 00 00 00 00 11 11 11 11 11 11 11 11
+3 +3
+1 +1
-1 -1

-3 -3

01 10 01 10 01 10 01 10 00 11 00 11 00 11 00 11
+3 +3
+1 +1
-1 -1

-3 -3

Case c Case d

P4-9. The data stream can be found as

a. NRZ-I: 10011001.
b. Differential Manchester: 11000100.
c. AMI: 01110001.

P4-11. The data rate is 100 Kbps. For each case, we first need to calculate the value
of f / N. We then use Figure 4.8 in the text to find P (energy per Hz). All calcu-
lations are approximations.

a. f /N = 0/100 =0 → P = 0.0
b. f /N = 50/100 = 1/2 → P = 0.3
c. f /N = 100/100 = 1 → P = 0.4
d. f /N = 150/100 = 1.5 → P = 0.0

P4-13. In 5B/6B, we have 25 = 32 data sequences and 26 = 64 code sequences. The


number of unused code sequences is 64 − 32 = 32. In 3B/4B, we have 23 = 8
data sequences and 24 = 16 code sequences. The number of unused code
sequences is 16 − 8 = 8.

P4-15.
4

a. In a low-pass signal, the minimum frequency 0. Therefore, we have


fmax = 0 + 200 = 200 KHz. → fs = 2 × 200,000 = 400,000 samples/s
b. In a bandpass signal, the maximum frequency is equal to the minimum fre-
quency plus the bandwidth. Therefore, we have
fmax = 100 + 200 = 300 KHz. → fs = 2 × 300,000 = 600,000 samples /s

P4-17. The maximum data rate can be calculated as

Nmax = 2 × B × nb = 2 × 200 KHz × log24 = 800 kbps

P4-19. We can calculate the data rate for each scheme:

a. NRZ → N=2 ×B=2 × 1 MHz = 2 Mbps


b. Manchester → N=1 ×B=1 × 1 MHz = 1 Mbps
c. MLT-3 → N=3 ×B=3 × 1 MHz = 3 Mbps
d. 2B1Q → N=4 ×B=4 × 1 MHz = 4 Mbps
CHAPTER 5

PRACTICE SET

Questions
Q5-1. Normally, analog transmission refers to the transmission of analog signals
using a band-pass channel. Baseband digital or analog signals are converted to
a complex analog signal with a range of frequencies suitable for the channel.

Q5-3. The process of changing one of the characteristics of an analog signal based
on the information in digital data is called digital-to-analog conversion. It is
also called modulation of a digital signal. The baseband digital signal repre-
senting the digital data modulates the carrier to create a broadband analog sig-
nal.

Q5-5. We can say that the most susceptible technique is ASK because the amplitude
is more affected by noise than the phase or frequency.

Q5-7. The two components of a signal are called I and Q. The I component, called
in-phase, is shown on the horizontal axis; the Q component, called quadrature,
is shown on the vertical axis.

Q5-9.

a. AM changes the amplitude of the carrier


b. FM changes the frequency of the carrier
c. PM changes the phase of the carrier

Problems
P5-1. We use the formula S = (1/r) × N, but first we need to calculate the value of r
for each case.

a. r = log22 =1 → S = (1/1) × (2000 bps) = 2000 baud


b. r = log22 =1 → S = (1/1) × (4000 bps) = 4000 baud

1
2

c. r = log24 =2 → S = (1/2) × (6000 bps) = 3000 baud


d. r = log264 =6 → S = (1/6) × (36,000 bps) = 6000 baud

P5-3. We use the formula r = log2L to calculate the value of r for each case.

a. log24 =2
b. log28 =3
c. log24 =2
d. log2128 =7

P5-5. See the following figure:

a. b.
Q Q

I I
2 3 –3 3

Q Q

2 2

I I
–2 2

–2 –2

c. d.

a. This is ASK. There are two peak amplitudes both with the same phase (0
degrees). The values of the peak amplitudes are A1 = 2 (the distance
between the first dot and the origin) and A2= 3 (the distance between the
second dot and the origin).
b. This is BPSK, There is only one peak amplitude (3). The distance between
each dot and the origin is 3. However, we have two phases, 0 and 180
degrees.
c. This can be either QPSK (one amplitude, four phases) or 4-QAM (one
amplitude and four phases). The amplitude is the distance between a point
and the origin, which is (22 + 22)1/2 = 2.83.
d. This is also BPSK. The peak amplitude is 2, but this time the phases are 90
and 270 degrees.
3

P5-7. We use the formula B = (1 + d) × (1/r) × N, but first we need to calculate the
value of r for each case.

a. r=1 → B= (1 + 1) × (1/1) × (4000 bps) = 8000 Hz


b. r=1 → B = (1 + 1) × (1/1) × (4000 bps) + 4 KHz = 8000 Hz
c. r=2 → B = (1 + 1) × (1/2) × (4000 bps) = 2000 Hz
d. r=4 → B = (1 + 1) × (1/4) × (4000 bps) = 1000 Hz

P5-9.
First, we calculate the bandwidth for each channel = (1 MHz) / 10 = 100 KHz.
We then find the value of r for each channel:

B = (1 + d) × (1/r) × (N) → r = N / B → r = (1 Mbps/100 KHz) = 10


We can then calculate the number of levels: L = 2r = 210 = 1024. This means
that we need a 1024-QAM technique to achieve this data rate.

P5-11.

a. BAM = 2 × B = 2 × 5 = 10 KHz
b. BFM = 2 × (1 + β) × B = 2 × (1 + 5) × 5 = 60 KHz
c. BPM = 2 × (1 + β) × B = 2 × (1 + 1) × 5 = 20 KHz
CHAPTER 6

PRACTICE SET

Questions
Q6-1. Multiplexing is the set of techniques that allows the simultaneous transmission
of multiple signals across a single data link.

Q6-3. In multiplexing, the word link refers to the physical path. The word channel
refers to the portion of a link that carries a transmission between a given pair
of lines. One link can have many (n) channels.

Q6-5. To maximize the efficiency of their infrastructure, telephone companies have


traditionally multiplexed analog signals from lower-bandwidth lines onto
higher-bandwidth lines. The analog hierarchy uses voice channels (4 KHz),
groups (48 KHz), supergroups (240 KHz), master groups (2.4 MHz), and
jumbo groups (15.12 MHz).

Q6-7. WDM is common for multiplexing optical signals because it allows the multi-
plexing of signals with a very high frequency.

Q6-9. In synchronous TDM, each input has a reserved slot in the output frame. This
can be inefficient if some input lines have no data to send. In statistical TDM,
slots are dynamically allocated to improve bandwidth efficiency. Only when
an input line has a slot’s worth of data to send is it given a slot in the output
frame.

Q6-11 The frequency hopping spread spectrum (FHSS) technique uses M different
carrier frequencies that are modulated by the source signal. At one moment,
the signal modulates one carrier frequency; at the next moment, the signal
modulates another carrier frequency.

Problems
P6-1. To multiplex 10 voice channels, we need nine guard bands. The required
bandwidth is then B = (4 KHz) × 10 + (500 Hz) × 9 = 44.5 KHz
1
2

P6-3.

a. Group level: overhead = 48 KHz − (12 × 4 KHz) = 0 Hz.


b. Supergroup level: overhead = 240 KHz − (5 × 48 KHz) = 0 Hz.
c. Master group: overhead = 2520 KHz − (10 × 240 KHz) = 120 KHz.
d. Jumbo Group: overhead = 16.984 MHz − (6 × 2.52 MHz) = 1.864 MHz.

P6-5.

a. Each output frame carries 2 bits from each source plus one extra bit for
synchronization. Frame size = 20 × 2 + 1 = 41 bits.
b. Each frame carries 2 bit from each source. Frame rate = 100,000/2 =
50,000 frames/s.
c. Frame duration = 1 /(frame rate) = 1 /50,000 = 20 ms.
d. Data rate = (50,000 frames/s) × (41 bits/frame) = 2.05 Mbps. The output
data rate here is slightly less than the one in Problem 4.
e. In each frame 40 bits out of 41 are useful. Efficiency = 40/41= 97.5%. Effi-
ciency is better than the one in Problem 4.

P6-7. We combine six 200-kbps sources into three 400-kbps. Now we have seven
400-kbps channel.

a. Each output frame carries 1 bit from each of the seven 400-kbps line.
Frame size = 7 × 1 = 7 bits.
b. Each frame carries 1 bit from each 400-kbps source. Frame rate = 400,000
frames/s.
c. Frame duration = 1 /(frame rate) = 1 /400,000 = 2.5 ms.
d. Output data rate = (400,000 frames/s) × (7 bits/frame) = 2.8 Mbps. We can
also calculate the output data rate as the sum of input data rate because
there is no synchronizing bits. Output data rate = 6 × 200 + 4 × 400 = 2.8
Mbps.

P6-9. We need to add extra bits to the second source to make both rates = 190 kbps.
Now we have two sources, each of 190 Kbps.

a. The frame carries 1 bit from each source. Frame size = 1 + 1 = 2 bits.

b. Each frame carries 1 bit from each 190-kbps source. Frame rate = 190,000
frames/s.

c. Frame duration = 1 /(frame rate) = 1 /190,000 = 5.3 ms.


3

d. Output data rate = (190,000 frames/s) × (2 bits/frame) = 380 kbps. Here the
output bit rate is greater than the sum of the input rates (370 kbps) because
of extra bits added to the second source.

P6-11. See the following figure.

O L E L Y I E B H H
TDM

P6-13. See the following figure.

000000011000
101010100111
TDM 10100000
10100111

P6-15. The number of hops = 100 KHz/4 KHz = 25. So we need log225 = 4.64 ≈ 5
bits

P6-17. Random numbers are 11, 13, 10, 6, 12, 3, 8, 9 as calculated below:

N1 = 11
N2 =(5 + 7 × 11) mod 17 − 1 = 13
N3 =(5 + 7 × 13) mod 17 − 1 = 10
N4 =(5 + 7 × 10) mod 17 − 1 = 6
N5 =(5 + 7 × 6) mod 17 − 1 = 12
N6 =(5 + 7 × 12) mod 17 − 1 = 3
N7 =(5 + 7 × 3) mod 17 − 1 = 8
N8 =(5 + 7 × 8) mod 17 − 1 = 9
CHAPTER 7

PRACTICE SET

Questions
Q7-1. The transmission media is located beneath the physical layer and controlled
by the physical layer.

Q7-3. Guided media have physical boundaries, while unguided media are
unbounded.

Q7-5. Twisting ensures that both wires are equally, but inversely, affected by external
influences such as noise.

Q7-7. The inner core of an optical fiber is surrounded by cladding. The core is
denser than the cladding, so a light beam traveling through the core is
reflected at the boundary between the core and the cladding if the incident
angle is more than the critical angle.

Q7-9. In sky propagation radio waves radiate upward into the ionosphere and are
then reflected back to earth. In line-of-sight propagation signals are transmit-
ted in a straight line from antenna to antenna.

Problems
P7-1. See the following table (the values are approximate).

Distance dB at 1 KHz dB at 10 KHz dB at 100 KHz


1 Km −3 −5 −7
10 Km −30 −50 −70
15 Km −45 −75 −105
20 Km −60 −100 −140

1
2

P7-3. We can use the table in P7-1 to find the power for different frequencies:

1 KHz dB = −3 P2 = P1 ×10−3/10 = 100.23 mw


10 KHz dB = −5 P2 = P1 ×10−5/10 = 63.25 mw
100 KHz dB = −7 P2 = P1 ×10−7/10 = 39.90 mw

The table shows that the power is reduced 5 times, which may not be accept-
able for some applications.

P7-5. As the table in P7-4 shows, for a specific maximum value of attenuation, the
highest frequency decreases with distance. If we consider the bandwidth to
start from zero, we can say that the bandwidth decreases with distance. For
example, if we can tolerate a maximum attenuation of 50 dB (loss), then we
can give the following listing of distance versus bandwidth.

Distance Bandwidth
1 Km 100 KHz
10 Km 1 KHz
15 Km 1 KHz
20 Km 0 KHz

P7-7. We can use the formula f = c / λ to find the corresponding frequency for each
wave length as shown below (c is the speed of propagation):

a. B = [(2 × 108)/1000×10−9] − [(2 × 108)/ 1200 × 10−9] = 33 THz


b. B = [(2 × 108)/1000×10−9] − [(2 × 108)/ 1400 × 10−9] = 57 THz

P7-9. See the following table (The values are approximate).

Distance dB at 800 nm dB at 1000 nm dB at 1200 nm


1 Km −3 −1.1 −0.5
10 Km −30 −11 −5
15 Km −45 −16.5 −7.5
20 Km −60 −22 −10
3

P7-11. See the following figure.

Refraction

a. 40 degrees Critical angle = 60

Critical angle

Refraction

b. 60 degrees Critical angle = 60


Critical angle

Reflection

c. 80 degrees Critical angle = 60

Critical angle

a. The incident angle (40 degrees) is smaller than the critical angle (60
degrees). We have refraction.The light ray enters into the less dense
medium.
b. The incident angle (60 degrees) is the same as the critical angle (60
degrees). We have refraction. The light ray travels along the interface.
c. The incident angle (80 degrees) is greater than the critical angle (60
degrees). We have reflection. The light ray returns back to the more dense
medium.
CHAPTER 8

PRACTICE SET

Questions
Q8-1. Switching provides a practical solution to the problem of connecting multiple
devices in a network. It is more practical than using a bus topology; it is more
efficient than using a star topology and a central hub. Switches are devices
capable of creating temporary connections between two or more devices
linked to the switch.

Q8-3. There are two approaches to packet switching: datagram approach and vir-
tual-circuit approach.

Q8-5. The address field defines the end-to-end (source to destination) addressing.

Q8-7. In a space-division switch, the path from one device to another is spatially
separate from other paths. The inputs and the outputs are connected using a
grid of electronic microswitches. In a time-division switch, the inputs are
divided in time using TDM. A control unit sends the input to the correct out-
put device.

Q8-9. The two categories of circuit switches are space-division and time-division. In
a space-division switch, the paths are separated from one another spatially. In
a time-division switch, TDM technology is used to separate paths from one
another.

Problems
P8-1. We assume that the setup phase is a two-way communication and the tear-
down phase is a one-way communication. These two phases are common for
all three cases. The delay for these two phases can be calculated as three prop-
agation delays and three transmission delays or

3 [(5000 km)/ (2 ×108 m/s)]+ 3 [(1000 bits/1 Mbps)] = 75 ms + 3 ms = 78 ms


We assume that the data transfer is in one direction; the total delay is then
1
2

delay for setup and teardown + propagation delay + transmission delay


a. 78 + 25 + 1 = 104 ms
b. 78 + 25 + 100 = 203 ms
c. 78 + 25 + 1000 = 1103 ms
d. In case a, we have 104 ms. In case b we have 203/100 = 2.03 ms. In case c,
we have 1103/1000 = 1.101 ms. The ratio for case c is the smallest because
we use one setup and teardown phase to send more data.

P8-3.

a. In a circuit-switched network, end-to-end addressing is needed during the


setup and teardown phase to create a connection for the whole data transfer
phase. After the connection is made, the data flow travels through the
already-reserved resources. The switches remain connected for the entire
duration of the data transfer; there is no need for further addressing.
b. In a datagram network, each packet is independent. The routing of a packet
is done for each individual packet. Each packet, therefore, needs to carry an
end-to-end address. There is no setup and teardown phases in a datagram
network (connectionless transmission). The entries in the routing table are
somehow permanent and made by other processes such as routing proto-
cols.
c. In a virtual-circuit network, there is a need for end-to-end addressing dur-
ing the setup and teardown phases to make the corresponding entry in the
switching table. The entry is made for each request for connection. During
the data transfer phase, each packet needs to carry a virtual-circuit identi-
fier to show which virtual-circuit that particular packet follows.

P8-5. In circuit-switched and virtual-circuit networks, we are dealing with connec-


tions. A connection needs to be made before the data transfer can take place.
In the case of a circuit-switched network, a physical connection is established
during the setup phase and the is broken during the teardown phase. In the
case of a virtual-circuit network, a virtual connection is made during setup and
is broken during the teardown phase; the connection is virtual, because it is an
entry in the table. These two types of networks are considered connection-ori-
ented. In the case of a datagram network no connection is made. Any time a
switch in this type of network receives a packet, it consults its table for routing
information. This type of network is considered a connectionless network.

P8-7.

a. Packet 1: 2
b. Packet 2: 3
c. Packet 3: 3
3

d. Packet 4: 2

P8-9.

a. In a datagram network, the destination addresses are unique. They cannot


be duplicated in the routing table.
b. In a virtual-circuit network, the VCIs are local. A VCI is unique only in
relationship to a port. In other words, the (port, VCI) combination is
unique. This means that we can have two entries with the same input or
output ports. We can have two entries with the same VCIs. However, we
cannot have two entries with the same (port, VCI) pair.

P8-11.

a. If n > k, an n × k crossbar is like a multiplexer that combines n inputs into k


outputs. However, we need to know that a regular multiplexer discussed in
Chapter 6 is n × 1.
b. If n < k, an n × k crossbar is like a demultiplexer that divides n inputs into k
outputs. However, we need to know that a regular demultiplexer discussed
in Chapter 6 is 1 × n.

P8-13.

a. See the following figure.

10 6 10
Crossbars Crossbars Crossbars

n = 10 10 × 6 6 × 10 n = 10

10 × 10


N = 100 n = 10 10 × 6 6 × 10 n = 10 N = 100


10 × 10

n = 10 n = 10

10 × 6 6 × 10

Stage 1 Stage 2 Stage 3

b. The total number of crosspoints are


Number of crosspoints = 10 (10 × 6) + 6 (10 × 10) + 10 (6 × 10) = 1800
c. Only six simultaneous connections are possible for each crossbar at the
first stage. This means that the total number of simultaneous connections is
60.
d. If we use one crossbar (100 × 100), all input lines can have a connection at
the same time, which means 100 simultaneous connections.
4

e. The blocking factor is 60/100 or 60 percent.

P8-15.

a. Total crosspoints = N2 = 10002 = 1,000,000


b. Total crosspoints ≥ 4Ν[(2Ν)1/2 −1] ≥ 174,886. With less than 200,000
crosspoints we can design a three-stage switch. We can use n = (N/2)1/2
=23 and choose k = 45. The total number of crosspoints is 178,200.
CHAPTER 9

PRACTICE SET

Questions
Q9-1. Communication at the network layer is host-to-host; communication at the
data-link layer is node-to-node.

Q9-3. Two hosts in two different networks can theoretically have the same link-layer
address because a link-layer address has only local jurisdiction. However, the
tendency is to avoid this for the future development of the Internet. Even
today, manufacturers of network interface cards (NIC) use different set of
link-layer addresses to make them distinguished.

Q9-5. ARP Packet Size = 2 + 2 + 1 + 1 + 2 + 6 + 4 + 6 + 4 = 28 bytes (Figure 9. 8).

Q9-7. Station A does not know the link-layer address of station B yet. It uses an all-
zero address to define that this address is desired.

Q9-9. The source hardware address defines the link-layer address of station B.

Q9-11. A host does not know when another host sends an ARP request; it needs to be
ready all of the time to respond to an ARP request.

Q9-13. If an end-to-end address is changed during the packet journey, it is not guaran-
tee that the packet arrives at its destination.

Problems
P9-1. Theoretically, we do not need IP addresses because the global communication
is one to one. If a station has a packet to send to another station, it uses the
link-layer address of the destination host (or even port number related to the
destination) to send a packet. However, if the internet uses the TCP/IP proto-
col suite, then messages pass through the network layer and IP address come
to the picture.

1
2

P9-3. A router is need when we have more than one paths for the packet to travel
from the source to destination. In Figure 9.15 (in the text) there is only path in
each direction. We need no router.

P9-5. The current Internet is using packet-switching at the data-link layer. The
source divides the data at the data-link layer into frames and each frame is
independent.

P9-7. We can think of one journey with four links in this case: home-to-airport, air-
port-to-airport, and airport-to-home

a. End-to-end addresses (the whole journey)


Source: 2020 Main Street, Los Angeles
Destination: 1432 American Boulevard, Chicago
b.
First Link
Source: 2020 Main Street
Destination: Los Angeles Airport

Second Link
Source: Los Angeles Airport
Destination: Denver Airport

Third Link
Source: Denver Airport
Destination: Chicago Airport

Fourth Link
Source: Chicago Airport
Destination: 1432 American Boulevard

P9-9. The communication is impossible unless router R1 can reach router R2 using
another path (not shown in the figure).

P9-11. The packet cannot be delivered unless system A broadcast it and system B
receive it. In this case, all stations receive the packet. Other stations should
drop it.

P9-13. Two approaches can be used. In the first approach, system A has a table to
match the network-layer addresses to data-link addresses, it can use the table
to find the data-link address of system B. In the second approach, system A
has only the list of all data-link layer addresses, it can send unicast ARP
packet to all stations to find out the one which matches the network-layer
address. None of the approaches are practical because a host may change its
data-link layer address without notice (by changing NIC as we see in Chapter
3

13). Some networks support tunneling, in which the network encapsulates a


broadcast or multicast packet in a unicast packet and send them to all stations.

P9-15.

a. A: host B: router
b. A: router B: router
c. A: router B: host
d. A: host B: host
CHAPTER 10

PRACTICE SET

Questions
Q10-1. In a single-bit error only one bit of a data unit is corrupted; in a burst error
more than one bit is corrupted (not necessarily contiguous).

Q10-3. In this case, k = 20, r = 5, and n = 20. Five redundant bits are added to the
dataword to create the corresponding codeword.

Q10-5. The minimum Hamming distance is the smallest Hamming distance between
all possible pairs in a set of words.

Q10-7. We have n = 2r − 1 = 7 and k = n − 3 = 7 − 3 = 4. A dataword has four bits and


a codeword has seven bits. Although it is not asked in the question, we give
the datawords and valid codewords below. Note that the minimum distance
between the two valid codewords is 3.

Data Code Data Code


0000 0000000 1000 1000110
0001 0001101 1001 1001011
0010 0010111 1010 1010001
0011 0011010 1011 1011100
0100 0100011 1100 1100101
0101 0101110 1101 1101000
0110 0110100 1110 1110010
0111 0111001 1111 1111111

Q10-9.

a. The generator has three bits (more than required). Both the rightmost bit
and leftmost bits are 1s; it can detect all single-bit errors.
b. This cannot be used as a generator: the rightmost bit is 0.
c. This cannot be used as a generator; it has only one bit.

Q10-11. In this case r = 7 − 1 = 6.

1
2

a. The length of the error is L = 5, which means L ≤ r. All burst errors of this
size will be detected.
b. The length of the error is L = 7, which means L = r + 1. This CRC will
detect all burst errors of this size with the probability 1 − (0.5)5 ≈ 0.9688.
Almost 312 out of 10,000 errors of this length may be passed undetected.
c. The length of the error is L = 10, which means L > r. This CRC will detect
all burst errors of this size with the probability 1 − (0.5)6 ≈ 0.9844. Almost
156 out of 10,000 errors of this length may be passed undetected. Although
the length of the burst error is increased, the probability of errors being
passed undetected is decreased.

Q10-13. The value of a checksum can be all 0s (in binary). This happens when the
value of the sum (after wrapping) becomes all 1s (in binary).

Q10-15. The following shows that L is the weighted sum of the data items.

Beginning R=1 L=0


Iteration 1 R = 1 + D1 L = L + R = 0 + 1 + D1
Iteration 2 R = R + D2 = 1 + D1 + D2 L = L + R = 2 + 2D1 + D2
… … …
Iteration n R = 1 + D1 + D2 + … + Dn L = n + nD1 + …+ Dn

Problems
P10-1. We have (vulnerable bits) = (data rate) × (burst duration). The last example
shows how a noise of small duration can affect a large number of bits if the
data rate is high.

a. vulnerable bits = (1500) × (2 × 10−3) = 3 bits


b. vulnerable bits = (12 × 103) × (2 × 10−3) = 24 bits
c. vulnerable bits = (100 × 103) × (2 × 10−3) = 200 bits
d. vulnerable bits = (100 × 106) × (2 × 10−3) = 200,000 bits

P10-3. The following shows the results. In the interpretation, 0 means a word of all 0
bits, 1 means a word of all 1 bits, and ~X means the complement of X.

a. (10001) ⊕ (10001) = (00000) Interpretation: X ⊕ X → 0


b. (11100) ⊕ (00000) = (11100) Interpretation: X ⊕ 0 → X
c. (10011) ⊕ (11111) = (01100) Interpretation: X ⊕ 1 → ~X

P10-5. Answers are given below:

a. error b. error c. 0000 d. 1101


3

P10-7. The following shows the result. Part d shows that the Hamming distance
between a word and itself is 0.

a. d (10000, 00000) = 1 b. d (10101, 10000) = 2


c. d (00000, 11111) = 5 d. d (00000, 00000) = 0

P10-9. The CRC-8 is 9 bits long, which means r = 8.

a. It has more than one bit and the rightmost and leftmost bits are 1s; it can
detect a single-bit error.

b. Since 6 ≤ 8, a burst error of size 6 is detected.

c. Since 9 = 8 + 1, a burst error of size 9 is detected most of the time; it may


be left undetected with probability (1/2)r−1 or (1/2)8−1≈ 0.008.

d. Since 15 > 8 + 1, a burst error of size 15 is detected most of the time; it may
be left undetected with probability (1/2)r or (1/2)8 ≈ 0.004.

P10-11. The following shows the errors and how they are detected.

C1 C2 C3 C4 C5 C6 C7 C1 C2 C3 C4 C5 C6 C7
R1 1 1 0 0 1 1 1 1 R1 1 1 0 0 1 1 1 1
R2 1 0 1 1 1 0 1 1 R2 1 0 1 1 1 0 1 1
R3 0 1 1 1 0 0 1 0 R3 0 1 1 0 0 1 1 0
R4 0 1 0 1 0 0 1 1 R4 0 1 0 1 0 0 1 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

a. Detected and corrected b. Detected

C1 C2 C3 C4 C5 C6 C7 C1 C2 C3 C4 C5 C6 C7
R1 1 1 0 0 1 1 1 1 R1 1 0 0 0 1 0 1 1
R2 1 0 1 0 0 0 1 1 R2 1 0 1 1 1 0 1 1
R3 0 1 1 0 0 0 1 0 R3 0 0 1 1 0 1 1 0
R4 0 1 0 1 0 0 1 1 R4 0 1 0 1 0 0 1 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

c. Detected d. Not detected


4

a. In the case of one error, it can be detected and corrected because the two
affected parity bits can define where the error is.

b. Two errors can definitely be detected because they affect two bits of the
column parity.The receiver knows that the message is somewhat corrupted
(although not where). It discards the whole message.

c. Three errors are detected because they affect two parity bits, one of the col-
umn parity and one of the row parity. The receiver knows that the message
is somewhat corrupted (although not where). It discards the whole mes-
sage.

d. The last case cannot be detected because none of the parity bits are
affected.

P10-13.

a. (x3 + x2 + x + 1) + (x4 + x2 + x + 1) = x4 + x3
b. (x3 + x2 + x + 1) − (x4 + x2 + x + 1) = x4 + x3
c. (x3 + x2) × (x4 + x2 + x + 1) = x7 + x6 + x5 + x2
d. (x3 + x2 + x + 1) / (x2 + 1) = x + 1 (remainder is 0)

P10-15. To detect single bit errors, a CRC generator must have at least two terms and
the coefficient of x0 must be nonzero.

a. x3 + x + 1 → It meets both critic.


b. x4 + x2 → It meets the first criteria, but not the second.
c. 1 → It meets the second criteria, but not the first.
d. x2 + 1 → It meets both criteria.

P10-17. This generator is x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2
+ x + 1.

a. It has more than one term and the coefficient of x0 is 1. It detects all single-
bit error.
b. The polynomial is of degree 32, which means that the number of checkbits
(remainder) r = 32. It will detect all burst errors of size 32 or less.
c. Burst errors of size 33 are detected most of the time, but they are slip by
with probability (1/2)r−1 or (1/2)32−1≈ 465 × 10−12. This means 465 out of
1012 burst errors of size 33 are left undetected.
5

d. Burst errors of size 55 are detected most of the time, but they are slipped
with probability (1/2)r or (1/2)32 ≈ 233 × 10−12. This means 233 out of 1012
burst errors of size 55 are left undetected.

P10-19. The following shows the steps:

a. We first add the numbers in two’s complement to get 212,947.


b. We divide the above result by 65,536 (or 216). The quotient is 3 and the
remainder is 16,339. The sum of the quotient and the remainder is 16,342.
c. Finally, we subtract the sum from 65,535 (or 216 − 1), simulating the com-
plement operation, to get 49,193 as the checksum.

P10-21.

a. We calculate R and L values in each iteration of the loop and then concate-
nate L and R to get the checksum. All calculations are in hexadecimal and
modulo 256 or (FF)16. Note that R needs to be calculated before L in each
iteration (L = Lprevious + R).
Initial values: R = 00 L = 00
Iteration 1: R = 00 + 2B = 2B L = 00 + 2B = 2B
Iteration 2: R = 2B + 3F = 6A L = 2B + 6A = 95
Iteration 3: R = 6A + 6A = D4 L = 95 + D4 = 69
Iteration 4: R = D4 + AF = 83 L = 69 + 83 = EC
Checksum = EC83

b. The L and R values can be calculated as shown below (Di is the corre-
sponding bytes), which shows that L is the weighted sum of bytes.
R = D1 + D2 + D3 + D4 = 2B + 3F + 6A + AF = 83
L = 4 × D1 + 3 × D2 + 2 × D3 + 1 × D4 = EC

P10-23. We use modulo-11 calculation to find the check digit:

C = (1 × 0) + (2 × 0) + (3 × 7) + (4 × 2) + (5 × 9) + (6 × 6) + (7 × 7) + (8 × 7) +
(9 × 5) mod 11 = 7

P10-25. The receiver misses samples 21, 23, 25, 27, 29, 31, 33, 35, 37, and 39. How-
ever, the even-numbered samples are received and played. There may be some
glitches in the audio, but that passes immediately.

P10-27. The redundant bits in this case need to find (n + 1) different states because the
corruption can be in any of the n bits or in no bits (no corruption). A set of r
bits can define 2r states. This means that we need to have the following rela-
tionship: 2r ≥ n + 1. We need to solve the equation for each value of k using
trial and error to find the minimum value of r.
6

a. If k = 1, then r = 2 and n = 3 because (22 ≥ 3 + 1), which means C(3, 1).


b. If k = 2, then r = 3 and n = 5 because (23 ≥ 5 + 1), which means C(5, 1).
c. If k = 5, then r = 4 and n = 9 because (24 ≥ 9 + 1), which means C(9, 5).
d. If k = 50, then r = 6 and n = 56 because (26 ≥ 56 + 1), which means
C(56, 50).
e. If k = 1000, then r = 10 and n = 1010 because 210 ≥ 1010 + 1, which means
C(1010, 1000).

P10-29. If we need to correct m bits in an n bit codeword, we need to think about the
combination of n objects taking no object at a time or Com(n, 0), which means
the state of no error, the combination of n objects taking one object at a time or
Com (n, 1), which means the state of one-bit error, the combination of n
objects taking two objects at a time or Com(n, 2), which means the state of
two-bit error, and so on. We can have the following relationship between the
value of r (number of redundant bits) and the value of m (the number of
errors) we need to correct.

2r ≥ Com(n, m) + Com(n, m−1) + … + Com(n, 1) + Com(n, 0)


C H A P T E R 11

PRACTICE SET

Questions
Q11-1. The data link layer needs to pack bits into frames. Framing divides a message
into smaller entities to make flow and error control more manageable.

Q11-3. The answer is negative. We need to distinguish between a byte and a charac-
ter. It is better to think of a byte as the data unit at the data-link layer and the
character as the data unit at the application layer. The application layer was
designed to use one byte representing a character (ASCII). Today the tendency
is to use two or more bytes as representing one character (to show characters
in other languages and for other purposes). This does not mean that if a char-
acter is represented as two or more bytes at the application layer, we need to
change the protocol at the data-link layer. A character in the application layer
may change to two bytes (or more), but at the data-link layer, we treat them as
two separate bytes. The size of the flag or other control characters remain the
same.

Q11-5. Byte-oriented protocols use byte-stuffing to be able to carry an 8-bit pattern


that is the same as the flag. Byte-stuffing adds an extra character to the data
section of the frame to escape the flag-like pattern. Bit-oriented protocols use
bit-stuffing to be able to carry patterns similar to the flag. Bit-stuffing adds an
extra bit to the data section of the frame whenever a sequence of bits is similar
to the flag.

Q11-7. The flags are the delimiters of the original frames. We need first to unstuff the
frame to remove extra bits. The flags are removed later when we want to
deliver data to the upper layer.

Q11-9. The packet from the network layer should be rejected.

1
2

Q11-11. As we said in answer to the question Q11-10, theoretically, there should be


only one frame in transit at any time in the Stop-and-Wait protocol. However,
after a timeout, if the sent frame is not acknowledged, the sender assumes that
the frame is lost and sends a copy of the frame, but this does not mean that two
frames are in transit. This is the situation in Figure 11.13 when Frame 1 is lost.

Q11-13. The timer belongs to the sender entity. The ready or blocking is the state of the
sender. However, in this protocol, the sender does not use the timer when it is
in ready state. It only uses when it is in the blocking state.

Q11-15. The slop of the line between two vertical time line shows the time spent to
move from one situation to another. We assume that encapsulation of the
packets in frames, or vice versa, takes a very short time (negligible). We have
shown this as the horizontal line. On the other hand, sending a frame from one
station to another through media takes a loner time. We have shown this as a
diagonal line.

Q11-17. We need two channels, but not necessarily two media. The same media can be
divided into two channels using multiplexing techniques we learned before.

Q11-19. In this protocol, the S-frame is used for acknowledgment.

Q11-21. PPP is normally used to create a point-to-point communication between a


main computer and a desktop computer such as the case when a desktop com-
puter at home is connected to the main computer of an ISP. When we talk
about the system, we are referring to the ISP computer; when we talk about
the user, we are referring to the desktop computer.

Q11-23. PPP uses two different one-byte values as the flag and the escape bytes. The
flag byte is (01111110)2, but the escape byte is (01111101)2.

Problems
P11-1. Each escape or flag byte must be pre-stuffed with an escape byte. The follow-
ing shows the result. The red bytes show the added ones.

D E E D D E F D D E E E E D E F D
3

P11-3. The following shows the result. We inserted extra 0 after each group of five
consecutive 1’s.

0001111101100111110010001111101111110000111

P11-5. See the errata (The figure to be changed is Figure 11.11 not Figure 11.9). We
change the figure as shown below. Note that sender remains in the blocking
state when it receives a NAK.

Sending node
Packet came from network layer.
Make a frame, save a copy, and send the frame. Time-out.
Start the timer. Resend the saved frame.
Restart the timer.
Ready Blocking
Corrupted ACK or
NAK arrived.
Start Discard the ACK or NAK
Error-free ACK arrived.
Stop the timer. Error-free NAK arrived.
Discard the saved frame. Resend the saved frame.
Restart the timer.

Receiving node

Corrupted frame arrived.


Error-free frame arrived.
Discard the frame.
Extract and deliver the packet
Send NAK. Ready Send ACK.

Start
4

P11-7. The following figure shows the situation.

Sending Network Data-link Data-link Network


Receiving
node node

Packet Frame
Packet
ACK

Packet Frame
ACK
Frame (resent) Lost
Time-out
Packet

Time-out Frame (resent)


Packet
ACK Discarded
by upper
layers
Time Time Time Time

P11-9.

a. The sender stops the timer and discards the saved frame. It is ready to
receive new packets from the upper layer.
b. The sender resend a copy of the saved frame and starts a new timer.
c. This situation never happens. When the timer is running, the sender is at
the blocking state, not the ready state.

P11-11. The following figure shows the states, events, actions, and transitions.

Event 1 Event 3

State I State II

Event 5 Event 3
Action 1. Action 1.
Event 2 Action 2. Event 4
Action 1. Action 2.
Action 4.
Action 2. Action 6
Action 5.

State III
Event 2
5

P11-13. The following figure shows the FSM.

Sender

Request came from application.


Make a frame with seqNo = S, Time-out.
save a copy, and send it. Resend the saved frame.
Start the timer. Restart the timer.

Ready Blocking An ACK with ackNo


not related to the only
outstanding frame arrived.
Start Error-free ACK with ackNo = S + 1 arrived. Discard the ACK.
Set (S = S + 1). Note:
Stop the timer. All arithmetic equations
are in modulo 2.
Receiver
Corrupted packet arrived. Error-free packet with seqNo = R arrived.
Discard the packet. Deliver the packet to application.
Ready Set (R = R + 1).
Start
Send ACK with ackNo = R.

Error-free frame with seqNo ≠ R arrived. Note:


Discard the packet (it is duplicate). All arithmetic equations
Send ACK with ackNo = R. are in modulo 2.

P11-15. The user and the system exchange LCP packets in this phase.

The user sends a configuration request packet.


The system responds with either a configuration ack or configuration nak packet.

P11-17.

a. The following shows the exchange of payload:

The user sends an authentication request packet.


The system sends either an ack or a nak packet.

b.

The system sends a challenge packet.


The user sends a response packet.
The system sends either a success or a failure packet.
CHAPTER 12

PRACTICE SET

Questions
Q12-1. The answer is CSM/CD.

a. CSMA/CD is a random-access protocol.


b. Polling is a controlled-access protocol.
c. TDMA is a channelization protocol.

Q12-3. The answer is CDMA.

a. ALOHA is a random-access protocol.


b. Token-passing is a controlled-access protocol.
c. CDMA is a channelization protocol.

Q12-5. The transmission rate of this network is Tfr = (1000 bits)/(1Mbps) = 1 ms. The
vulnerable time in slotted Aloha is Tfr = 1ms.

Q12-7. In a slotted Aloha, the throughput at G = 1/2 is 30.2%.

a. When G = 1, the throughput is increased to the maximum value of 36.8%.


b. When G = 1/4, the throughput is increased to 32.1%

Q12-9. The use of K in Figure 12.13 decreases the probability that a station can
immediately send when the number of failures increases. This means decreas-
ing the probability of collision.

a. After one failure (K = 1), the value of R is 0 or 1. The probability that the
station gets R = 0 (send immediately) is 1/2 or 50%.
b. After four failures (K = 4), the value of R is 0 to 15. The probability that
the station gets R = 0 (send immediately) is 1/16 or 6.25%.

Q12-11. Success in an Aloha network is interpreted as receiving an acknowledgment


for a frame.

1
2

Q12-13. Success in an CSMA/CA network is interpreted as receiving an acknowledg-


ment for a frame.

Q12-15. The sender needs to detect the collision before the last bit of the frame is sent
out. If the collision occurs near the destination, it takes 2 × 3 = 6 μs for the
collision news to reach the sender. The sender has already sent out the whole
frame; it is not listening for a collision anymore.

Q12-17. In random-access methods, there is no control over the medium access. Each
station can transmit when it desires. This liberty may create collisions. In con-
trolled-access methods, the access to the medium is controlled, either by an
authority or by the priority of the station. There is no collision.

Q12-19. The last bit is 10 μs behind the first bit.

a. It takes 5 μs for the first bit to reach the destination.


b. The last bit arrives at the destination 10 μs after the first bit.
c. The network is involved with this frame for 5 + 10 = 15 μs.

Q12-21. We can mention the following strategies:

a. It uses the combination of RTS and CTS frames to warn other stations that
a new station will be using the channel.
b. It uses NAV to prevent other stations to transmit.
c. It uses acknowledgments to be sure the data has arrived and there is no
need for resending the data.

Q12-23. In CSMA/CD, the lack of detecting collision before the last bit of the frame is
sent out is interpreted as an acknowledgment. In CSMA/CA, the sender can-
not sense collision; there is a need for explicit acknowledgments.

Problems
P12-1. In both pure and slotted Aloha networks, the average number of frames cre-
ated during a frame transmission time (Tfr) is G.

a. For a pure Aloha network, the vulnerable time is (2 × Tfr), which means
that λ = 2G.
p[x] = (e−λ × λx) / (x!) = (e−2G × (2G)x) / (x!)

b. For a slotted Aloha network, the vulnerable time is (Tfr), which means that
λ = G.
3

p[x] = (e−λ × λx) / (x!) = (e−G × (G)x) / (x!)

P12-3. The throughput for each network is S = G × P[success for a frame].

a. For a pure Aloha network, P[success for a frame] = e−2G.


S = G × P[success for a frame] = Ge−2G

b. For a pure Aloha network, P[success for a frame] = e−G.


S = G × P[success for a frame] = Ge−G

P12-5. We can find the probability for each network type separately:

a. In a pure Aloha network, a station can send a frame successfully if no other


station has a frame to send during two frame transmission times (vulnera-
ble time). The probability that a station has no frame to send is (1 − p). The
probability that none of the N − 1 stations have a frame to send is definitely
(1 − p)N − 1. The probability that none of the N − 1 stations have a frame to
send during a vulnerable time is (1 − p)2(N − 1). The probability of success
for a station is then
P[success for a particular station] = p (1 − p)2(N − 1)

b. In a slotted Aloha network, a station can send a frame successfully if no


other station has a frame to send during one frame transmission time (vul-
nerable time).
P[success for a particular station] = p (1 − p)(N − 1)

P12-7. To find the value of p that maximizes the throughput, we need to find the
derivative of S with respect to p, dS/dp, and set the derivative to zero. Note
that for large N, we can say N − 1 ≈ N.

a. The following shows that, in a pure Aloha network, for a maximum


throughput p = 1/(2N) and the value of the maximum throughput for a large
N is Smax = e−1/ 2, as we found using the Poisson distribution:
S = Np (1 − p)2(N − 1) → dS/dp = N (1 − p)2(N − 1) − 2Np(N − 1)(1 − p)2(N − 1) − 1
dS/dp = 0 → (1 − p)− 2(N − 1)p = 0 → p = 1 / (2N − 1) ≈ 1 / (2N)
Smax = N[1/(2N)] [1 − 1/(2N)]2N = (1/2) [1 − 1/(2N)]2N = (1/2) e−1

b. The following shows that, in a slotted Aloha network, for a maximum


throughput p = 1/N and the value of the maximum throughput for a large N
is Smax = e−1, as we found using the Poisson distribution:
S = Np (1 − p)(N − 1) → dS/dp = N (1 − p)(N − 1) − Np(N − 1)(1 − p)(N − 1) − 1
4

dS/dp = 0 → (1 − p)− (N − 1)p = 0 → p = 1 / N.


Smax = N[1/(N)] [1 − 1/(N)]N = [1 − 1/(N)]N = e−1

P12-9. We first find the probability of success for each station in any slot (PSA, PSB,
and PSC). A station is successful in sending a frame in any slot if it has a frame
to send and the other stations do not.

PSA = (pA) (1 − pB) (1 − pC) = (0.2) (1 − 0.3) (1 − 0.4) = 0.084


PSB = (pB) (1 − pA) (1 − pC) = (0.3) (1 − 0.2) (1 − 0.4) = 0.144
PSC = (pC) (1 − pA) (1 − pB) = (0.4) (1 − 0.2) (1 − 0.3) = 0.224

We then find the probability of failure for each station in any slot (PFA, PFB,
and PFC).
PFA = (1 − PSA) = 1 − 0.084 = 0.916
PFB = (1 − PSB) = 1 − 0.144 = 0.856
PFC = (1 − PSC) = 1 − 0.224 = 0.776

a. Probability of success for any frame in any slot is the sum of probabilities
of success.
P[success in first slot] = PSA+ PSB + PSC = (0.084) + (0.144) + (0.224) ≈ 0.452

b. Probability of success for the first time in the second slot is the product of
failure in the first and success in the second.
P[success in second slot for A] = PFA× PSA= (0.916) × (0.084) ≈ 0.077

c. Probability of success for the first time in the third slot is the product of
failure in two slots and success in the third.
P[success in third slot for C] = PFC × PFC × PSC = (0.776)2 × (0.224) ≈ 0.135

P12-11. The data rate (R) defines how many bits are generated in one second and the
propagation speed (V) defines how many meters each bit is moving per sec-
ond. Therefore, the number of bits in each meter nb/m= R / V. In this case,

nb/m = R / V = (100 × 106 bits/s) / (2 × 108 m/s) = 1/2 bits/m.

P12-13. Let Lm be the length of the medium in meters, V the propagation speed, R the
data rate, and nb/m the number of bits that can fit in each meter of the medium
(defined in the previous problems). We can then proceed as follows:

a = (Tp) / (Tfr) = (Lm/ V) / (Fb / R) = (Lm / Fb) × (R / V)


5

We have (R / V) = nb/m → a = (Lm / Fb) × (nb/m)

Since Lb = Lm × nb/m → a = (Lb / Fb)

P12-15. The propagation delay for this network is Tp = (2000 m) /(2 × 108 m/s) = 10
μs. The first bit of station A’s frame reaches station B at (t1 + 10 μs).

a. Station B has not received the first bit of A’s frame at (t1 + 10 μs). It senses
the medium and finds it free. It starts sending its frame, which results in a
collision.
b. At time (t1 + 11 μs), station B has already received the first bit of station
A’s frame. It knows that the medium is busy and refrains from sending.

P12-17. The first bit of each frame needs at least 25 μs to reach its destination.

a. The frames collide because 2 μs before the first bit of A’s frame reaches the
destination, station B starts sending its frame. The collision of the first bit
occurs at t = 24 μs.
b. The collision news reaches station A at time t = 24 μs + 24 μs = 48 μs. Sta-
tion A has finished transmission at t = 0 + 40 = 40 μs, which means that the
collision news reaches station A 8 μs after the whole frame is sent and sta-
tion A has stopped listening to the channel for collision. Station A cannot
detect the collision because Tfr < 2 × Tp.
c. The collision news reaches station B at time t = 24 + 1 = 25 μs, just two μs
after it has started sending its frame. Station B can detect the collision.

P12-19. We calculate the probability in each case:

a. After the first collision (k = 1), R has the range (0, 1). There are four possi-
bilities (00, 01, 10, and 11), in which 00 means that both station have come
up with R = 0, and so on. In two of these four possibilities (00 or 11), a col-
lision may occur. Therefore the probability of collision is 2/4 or 50 percent.
b. After the second collision (k = 2), R has the range (0, 1, 2, 3). There are six-
teen possibilities (00, 01, 02, 03, 10, 11, …, 33). In four of these sixteen
possibilities (00, 11, 22, 33), a collision may occur. Therefore the probabil-
ity of collision is 4/16 or 25 percent.

P12-21. We use the definition to find the throughput as S = 1 / (1 + 6.4a).

S = (Tfr) / (channel is occupied for a frame)


S = (Tfr) / (k × 2 × Tp + Tfr + Tp)
S = 1 / [2e (Tp) / (Tfr) + (Tfr) / (Tfr) + Tp / (Tfr)]
S = 1 / [2ea + 1 + a] = 1 / [1 + (2e + 1)a] = 1 / (1 + 6.4a)
6

P12-23. We need to check three properties: the number of sequences (N) in each chip
should be a power of 2, the dot product of any pair of chips should be 0, and
the dot product of each chip with itself should be N.

a. The number of sequences, N = 2, is a power of 2.


b. [+1, +1] • [+1, −1] = (+1) + (−1) = 0
c. [+1, +1] • [+1, +1] = (+1) + (+1) = 2 = N
[+1, −1] • [+1, −1] = (+1) + (+1) = 2 = N
The code passes the text for the three properties; it is orthogonal.

P12-25. Alice sends the code (0110)2 and Bob sends the code (1011)2. A 0 bit is
changed to −1 and a 1 bit is changed to +1. In other words, Alice is sending dA
= (−1, +1, +1, −1) and Bob is sending dB = (+1, −1, +1, +1). Each data item is
multiplied by the corresponding code. The signal generated by Alice and Bob
is shown below.

d1 = 0 d2 = 1 d3 = 1 d4 = 0

Alice

d1 = 1 d2 = 0 d3 = 1 d4 = 1

Bob
Signal sent

Alice receives the signal and


multiplies it by Bob’s code.

+2 −2 +2 +2

Alice
[+2/2, −2/2, +2/2 +2/2] (1011)2 (B)16

−2 +2 +2 −2

Bob
[−2/2, +2/2, +2/2 −2/2] (0110)2 (6)16

Bob’s receives the signal and


multiplies it by Alice’s code.
CHAPTER 13

PRACTICE SET

Questions
Q13-1. In a full-duplex Ethernet, each station is connected to the switch and the
media is divided into two channels for sending and receiving. No two stations
compete to access the channels; each channel is dedicated.

Q13-3. The common traditional Ethernet implementations are 10Base5, 10Base2, 10-
Base-T, and 10Base-F.

Q13-5. The common Gigabit Ethernet implementations are 1000Base-SX, 1000Base-


LX, 1000Base-CX, and 1000Base-T4.

Q13-7. The preamble is a 56-bit field that provides an alert and timing pulse. It is
added to the frame at the physical layer and is not formally part of the frame.
SFD is a one-byte field that serves as a flag.

Q13-9. A bridge can raise the bandwidth and separate collision domains.

Problems
P13-1. We interpret each four-bit pattern as a hexadecimal digit. We then group the
hexadecimal digits with a colon between the pairs:

5A:11:55:18:AA:0F

P13-3. The first byte in binary is 00000111. The least significant bit is 1. This means
that the pattern defines a multicast address.

P13-5. The smallest Ethernet frame is 64 bytes and carries 46 bytes of data (and pos-
sible padding). The ratio is (data size) / (frame size) in percent. The Ratio is
71.9 percent.

1
2

P13-7. We can calculate the load for each activity (as shown below) and add them
together. The total load is 2,888,890 bps or almost 3 Mbps. However, we have
not specified how fast we want the files we want to be downloaded. We have
assumed that the employee is so patient to allow the files to be downloaded at
the portion of the rate assigned for part a. In real case, the total rate is much
higher.

a. If the LAN should handle only this case, we have


load = (all employees) × (file size) × (number of times per second)
load = (100) × (10,000,000 × 8) (10 / (8 × 3600)) ≈ 277,778 bps

b. If the LAN should handle only this case, we have


load = (10 employees) × (rate) = (10) × (250 Kbps) = 2,500,000 bps

c. If the LAN should handle only this case, we have


load = (half) × (all employees) × (e-mails/hour) × (size × 8bits) / (an hour)
load = (1/2) × (100) × (10) × (100,000 × 8) / (3600) ≈ 111,112 bps

P13-9. In a Fast Ethernet network, the data rate is 100 Mbps.

a. There are 100,000,000 bits on the channel in each second, which means
that (2/1000) × 100,000,000 = 200,000 bits are affected by the noise.
b. If each packet is 1000 bytes or 8,000 bits (assuming ASCII characters), this
means 200,000/8,000 = 25 packets. However, since the noise can start from
the beginning or near the end of the first packet, 25 or 26 packets are possi-
bly destroyed.

P13-11. In a 10-Gigabit Ethernet network, the data rate is 10 Gbps.

a. There are 10,000,000,000 bits on the channel in each second, which means
that (2/1000) × 10,000,000,000 = 20,000,000 bits are affected by the noise.
b. If each packet is 1000 bytes or 8,000 bits (assuming ASCII characters), this
means 20,000,000/8,000 = 2500 packets. However, since the noise can
start from the beginning or near the end of the first packet, 2500 or 2501
packets are possibly destroyed.
CHAPTER 14

PRACTICE SET

Questions
Q14-1. The telephone network is made of three major components: local loops,
trunks, and switching offices.

Q14-3. Signaling System Seven (SS7) is the protocol used to provide signaling ser-
vices in the telephone network. It is somehow similar to the five-layer Internet
model.

Q14-5. Dial-up modems use part of the bandwidth of the local loop to transfer data.
The latest dial-up modems use the V-series standards such as V.32 and V.32bis
(9600 bps), V.34bis (28,800 or 33,600 bps), V.90 (56 kbps for downloading
and 33.6 kbps for uploading), and V.92. (56 kbps for downloading and 48
kbps for uploading.

Q14-7. The traditional cable networks use only coaxial cables to distribute video
information to the customers. The hybrid fiber-coaxial (HFC) networks use a
combination of fiber-optic and coaxial cable to do so.

Q14-9. The cable modem (CM) is installed on the subscriber premises. The cable
modem transmission system (CMTS) is installed inside the distribution hub by
the cable company. It receives data from the Internet and passes them to the
combiner, which sends them to the subscriber. The CMTS also receives data
from the subscriber and passes them to the Internet.

Q14-11. SONET defines a hierarchy of electrical signaling levels called synchronous


transport signals (STSs). SDH specifies a similar system called a synchronous
transport modules (STMs).

Q14-13. STSs are the hierarchy of electrical signals defined by the SONET standards.
OCs are the corresponding optical signals.

Q14-15. A single clock handles the timing of transmission and equipment across the
entire network.

1
2

Q14-17. SONET defines four layers: path, line, section, and photonic.

Q14-19. A virtual tributary is a partial payload that can be inserted into an STS-1 and
combined with other partial payloads to fill out the frame. Instead of using all
86 payload columns of an STS-1 frame for data from one source, we can sub-
divide the SPE and call each component a VT.

Q14-21. The larger data items can block the access of small data items to the multi-
plexers. This results in unusual delays for small items. This may cause the
small data items to be assumed lost and resent.

Q14-23. A transmission path (TP) is the physical connection between a user and a
switch or between two switches. It is divided into several (VPs), which pro-
vide a connection or a set of connections between two switches. VPs in turn
consist of several virtual circuits (VCs) that logically connect two points
together.

Q14-25.

a. The Application Adaptation Layer (AAL) allows existing networks to con-


nect to ATM facilities by mapping packet data into fixed-sized ATM cells.
b. The ATM layer provides routing, traffic management, switching, and multi-
plexing services.
c. The Physical layer defines any transmission media that can be the carrier
of the cells.

Problems
P14-1. Telephone networks were designed to carry voice, which was not packetized.
A circuit-switched network, which dedicates resources for the whole duration
of the conversation, is more suitable for this type of communication.

P14-3. In a telephone network, the telephone numbers of the caller and callee are
serving as source and destination addresses. These are used only during the
setup (dialing) and teardown (hanging up) phases.

P14-5. Although we did not discuss these rate in the book, the following information
can be obtained from the Internet.

56 kbps
50 kbps

30 kbps

14.4 kbps
10 kbps 9600 bps

V.32 V.32bis V.90


3

P14-7. We can calculate the time based on the assumption of 56 Kbps data rate:

Time = (1,000,000 × 8) / 56,000 ≈ 143 seconds

P14-9. We can calculate the time based on the assumption of 10 Mbps data rate:

Time = (1,000,000 × 8) / 10,000,000 ≈ 0.8 seconds

P14-11. The cable modem technology is based on the bus (or rather tree) topology. The
cable is distributed in the area and customers have to share the available band-
width. This means if all neighbors try to transfer data, the effective data rate
will be decreased.

P14-13. Each STS-n frame carries (9 × n × 86) bytes of bytes. SONET sends 8000
frames in each second. We can then calculate the user data rate as follows:

STS-3 → 8000 × (9 × 3 × 86) × 8 = 148.608 Mbps


STS-9 → 8000 × (9 × 9 × 86) × 8 = 445.824 Mbps
STS-12 → 8000 × (9 × 12 × 86) × 8 = 594.432 Mbps

P14-15. The user data rate of STS-1 is (8000 × 9 × 86 × 8) = 49.536 Mbps. To carry a
load with a data rate 49.540, we need another 4 kbps. This means that we need
to insert 4000 / 8 = 500 bytes into every 8000 frames. In other words, 500 out
of every 8000 frames need to allow the H3 byte to carry data. For example, we
can have sequences of 16 frames in which the first frame is an overloaded
frame and then 15 frames are normal.

P14-17.

a. The minimum number of cells is 1. This happens when the data size £ 36
bytes. Padding is added to make it exactly 36 bytes. Then 8 bytes of header
creates a data unit of 44 bytes at the SAR layer.
b. The maximum number of cells can be determined from the maximum num-
ber of data units at the CS sublayer. If we assume no padding, the maxi-
mum size of the packet is 65535 + 8 = 65543. This needs 65543 / 44 ≈
1489.61. The maximum number of cells is 1490. This happens when the
data size is between 65,509 and 65,535 (inclusive) bytes. We need to add
between 17 to 43 (inclusive) bytes of padding to make the size 65552
bytes. The 8 byte overhead at the CS layer makes the total size 65560
which means 1490 data units of size 44.
CHAPTER 15

PRACTICE SET

Questions
Q15-1. The medium of a wired LAN is guided (cable or wire); the medium of a wire-
less LAN is unguided (air).

Q15-3. Propagation in a wireless LAN is not confined as in a wired LAN. In a wired


LAN, propagation is confined to the wires. Most of the original power may
reach the destination. In a wireless LAN, the power is distributed in a sphere
with the sender at the center and the receiver at one point on the surface. Only
a part of the power arrives at the receiver; the rest is lost in the air.

Q15-5. In a wireless environment, a receiving station may receive more than one sig-
nal from the same sender related to the same message. One of these signals
can be the one received directly; the others are signals reflected back from
some barrier. Since the signals have travelled different distances, they can be
out of phase. The combination of these signals creates a signal which is the
distorted version of the original signal sent by the sender. It is sometimes diffi-
cult to detect the original message. We often have difficulty understanding the
other party when talking on a cellular phone

Q15-7. Error rate is much higher in a wireless LAN than in a wired LAN. Fragmenta-
tion reduces the frame size and reduces the probability of error in a frame.

Q15-9. The answer is negative. The addresses are selected from the same address
space. For example, if locally there are one wireless and one wired device,
they cannot have the same MAC address; addresses should be unique.

Q15-11. In a wired network, a link-layer switch is connected to the hosts via point-to-
point dedicated connections; there is no need for addresses for communication
between hosts and the switch. In a wireless network, an AP is connected to the
hosts via a multicast network (air); the MAC addresses of the host and the AP
make the communication more efficient; when a host sends a frame to the AP,
all other hosts drop the received copy of the frame at the MAC sublayer when
they find that the frame does not belong to them.

1
2

Q15-13. A piconet is the smallest ad hoc network. It is made of one primary (master)
station and up to seven secondary (slave) stations. A scatternet is a larger ad
hoc network made by gluing two or more piconets using one of the secondary
stations in one piconet to act as the primary station in another piconet.

Q15-15. The allocated band for Bluetooth is the ISM 2.4 GHz band, which actually
spans from 2.4 GHz to 2.4835 GHz. This means that the bandwidth is actually
0.0835 GHz or 83.5 MHz.

Q15-17. The 83.5 MHz bandwidth in Bluetooth is divided into 79 channels, each of 1
MHz. The rest of the bandwidth is used for guard bands.

Q15-19. The modulation technique is GFSK (FSK with Gaussian bandwidth filtering).
The carrier frequencies are 2042 + n MHz, in which n can be 0 to 79 (in most
countries).

Q15-21. The L2CAP layer has a role similar to the LLC sublayer in a LAN. It provides
multiplexing, segmentation and reassembly, quality of service, and group
management.

Problems
P15-1. Address 1 in 802.11 always defines the destination address in the current
movement of the frame in the wireless environment. The following figure
shows address 1 in all four situations:

From DS To DS

A1
Legend
A1
A1 : address 1
b. 01 c. 10 : current move
: previous move
A1
Wireless DS : next move
a. 00 : frame

A1

d. 11

a. When both To DS and From DS bits are 0s, the communication is confined
to the BSS. The frame has not entered the BSS before the current move-
ment and will not leave the BSS after the current movement. We have an ad
3

hoc network; the communication is between two stations, which means


address 1 is the address of the destination host.

b. When To DS is 0 but From DS is 1, the frame is coming from a distribution


system (DS). The frame has entered the BSS and is travelling from the AP
to the destination station. Address1 is the address of the destination host.

c. When To DS is 1 but From DS is 0, the frame is going to a distribution sys-


tem (DS). The frame is travelling inside the BSS, but is supposed to leave
the AP and go to the DS. Address 1 is the address destination in the current
move, which is the AP.

d. When both To DS and From DS bits are 1s, the frame is travelling in the DS
itself, which is wireless. A frame is going from one AP in the source BSS
to another AP in the destination BSS, but we are interested in the address
field when the frame is travelling in the wireless DS. Address 1 is the
address of the AP in the destination BSS.

P15-3. In 802.11, what address 3 defines depends on the type of the network. In an ad
hoc, address 3 defines the BSS identification. In an infrastructure network, it
either defines the address of the source in the previous move or the address of
the destination in the next move, whichever is appropriate. The following fig-
ure shows address 3 in all four situations:

A3 A3

From DS To DS

Legend
A3 = BSS ID
A3 : address 3
b. 01 c. 10 : current move
: previous move
Wireless DS
: next move
a. 00 : frame

A3

d. 11

a. When both the To DS and From DS bits are 0s, the communication is con-
fined to the BSS. The frame has not entered the BSS before the current
movement and will not leave the BSS after the current movement. We have
an ad hoc network; the communication is between two stations. Address 3
will set to the BSS ID to emphasize that the frame belongs to this BSS.
Other BSSs that may accidentally receive the frame will discard it.

b. When To DS is 0 but From DS is 1, the frame is coming from a distribution


system (DS). The frame has entered the BSS and is travelling from the AP
to the destination station. Address 3 is the address of the device (station or
4

router) that originally sent the 802.3 frame. This address is needed for the
final destination in case a response is needed.

c. When To DS is 1 but From DS is 0, the frame is going to a distribution sys-


tem (DS). The frame is travelling inside the BSS, but is supposed to leave
the AP and go to the DS. Address 3 is the address of the device (host or
router) in the DS. This address helps the AP to create an 802.3 frame to
send to the DS.

d. When both the To DS and From DS bits are 1s, the frame is travelling in the
DS itself, which is wireless. A frame is going from one AP in the source
BSS to another AP in the destination BSS, but we are interested in the
address field when the frame is travelling in the wireless DS. Address 3 is
the address of the final destination host in the destination BSS. This
address helps the AP to know the destination of the frame that will travel in
the second BSS.

P15-5. We need to remember that the exchanged frames do not leave the BSS. All
addresses are addresses of entities inside the BSS. With this in mind, we
answer each question:

a. Since the exchanged frames do not leave the BSS, the values of both the To
DS and From DS bits in all frames are set to 0s. No frame comes from a
distribution system (From DS = 0) and no frame goes to a distribution sys-
tem (To DS = 0).

b. The RTS frame needs to be sent by the station that wants to send the data
frame, station A in this case. There are two addresses in this frame (address
1 and address 2). The value of address 1 is the recipient of the data frame
that follows (address 1 = B’s address); the value of address 2 is the address
of the station that will send the data frame (address 2 = A’s station). Note
that since the channel is a broadcast channel, every nonhidden station will
receive the RTS frame, but address 1 emphasizes that station B needs to
respond to the RTS frame.

c. The CTS frame needs to be sent by the future recipient of the data frame,
which is station B in this case. The value of address 1 in this frame (the
only address field) is the address of the intended recipient of the CTS
frame, which is station A. All stations that are not hidden from B also
receive this frame.

d. After receiving the CTS frame, station A can send the data frame. The
value of the address 1 field in this frame is the address of the recipient of
the frame, which is station B. The value of the address 2 field is the address
of the station sending the frame, which is station A. Address 3 in this case
is the address of any entity involved in the communication besides the
5

sender and receiver. Since there is no other entity involved, the address
chosen is the BSS identification, which has the same format as other MAC
addresses. This identification is used here to show that the communication
should be confined to this BSS. Stations in other BSSs should drop this
frame if it is accidentally received by them. The value of the address 4 field
is not used in this case because the frame does not leave the BSS.

e. The ACK frame needs to be sent by the recipient of the data frame, station
B in this case. The value of the address 1 in this frame is the address of the
station that sent the data frame, address A.

P15-7. We show the value of addresses in each communication phase:

a. Communication from station A to the AP1 occurs in a wireless environ-


ment (802.11). However, since the frame needs to go to the distribution
system ultimately, the value of the To DS bit is set to 1, but the value of the
From DS bit is zero.The situation is the same as the previous problem. The
addresses are as follows:

Address 1: AP1 Address 2: A Address 3: C Address 4: —

b. Communication from the AP1 to the AP2 now occurs in a wireless envi-
ronment; we need to consider four addresses. However, since the frame
needs to go to the distribution system and comes from the distribution sys-
tem, the value of both To DS bit and From DS are set to 1s. Address 1 is the
address of the immediate receiver, which is the address of the AP2.
Address 2 is the address of the immediate sender, which is the AP1.
Address 3 is the address of the final destination which is station C. Address
4 is the address of the original source, which is station A. The addresses are
shown below:

Address 1: AP2 Address 2: AP1 Address 3: C Address 4: A

c. Communication from the AP2 to station C occurs in a wireless environ-


ment (802.11) again. However, since the frame comes from a distribution
system, the value of the To DS bit is set to 0, but the value of the From DS
bit is 1. We need to consider four addresses. This is the same as the previ-
ous problem. Addresses are shown below:

Address 1: C Address 2: AP2 Address 3: A Address 4: —


6

P15-9. The following shows how the fields in the 802.3 frame are filled, by the AP,
from the fields of the 802.3 frame. The values of some fields are discarded.

AP Wireless Wired Not


address host host used
FC D Addr1 Addr2 Addr3 SC Addr4 Payload CRC 802.11
frame

Recalculated
Discarded Discarded
Discarded

DA SA Type Payload CRC 802.3


frame
Wired Wireless DA: Destination address
host host SA: Souce address

P15-11. The following shows the steps:

a. The host knows the IP address of its default router (address of interface
m2). It may also know the MAC address of this interface (in its cache).
Otherwise, the AP2 needs to send an ARP frame to discover. The host
encapsulates its IP datagram in an 802.11 frame in which address 1 is the
MAC address of the AP2 and address 2 is its own MAC address. Address 3
in this case is the MAC address of the router (interface m2). The frame is
sent to the AP2.
b. The AP2 receives the frame and changes the frame format. It now creates
an 802.3 frame in which the destination address is a copy of address 3 and
the source address is a copy of address 2 (the original host).

P15-13. DCF is using a version of the Stop-and-Wait protocol. Each frame is consid-
ered as one or more fragments. In other words, if a frame is not fragmented, it
is considered as the first and only fragment. Each fragment needs to be indi-
vidually acknowledged by an ACK frame. The sender does not send the frag-
ment until it receives the acknowledgment for the previous frame. The sender
sets a timer, and if the acknowledgment for a fragment does not arrive, it
resends it. The Stop-and-Wait protocol (used in this case), however, is simpler
than the one we discussed before because, in this case, no sequence number
and no acknowledgment number is used. Although a data frame has the SC
field, the sequence number and fragment number defined there are actually the
identification number and offset that define each fragment uniquely for the
purpose of reassembly.
7

P15-15. IP uses three fields in the header for fragmentation: identification (16 bits),
flags (3 bits), and offset (13 bits). The 802.11 protocol uses three subfields in
the header for this purpose: fragment number (4 bits), sequence number (12
bits), and more fragment (1 bit). The fragment number and sequence number
subfields are part of the sequence control (SC) field; the more fragment sub-
field is part of the frame control (FC) field. The following shows the relation-
ship between the fields in the two protocols:

16 bits 3 bits 13 bits


Identification M Offset

M Frag. No. Sequence No. M: 1-bit more fragment flag


4 bits 12 bits

P15-17. To better understand the value of the NAV that needs to be set for each frame,
we first show the time line for the transactions and the NAV (ignoring the
propagation delay) in the following figure.

SIFS SIFS
SIFS

RTS Data Time


CTS ACK

RTS’s NAV CTS + Data + ACK + 3 × SIFS

CTS’s NAV Data + ACK + 2 × SIFS

ACK +
Data’s NAV SIFS

Based on the figure, we have the following NAV durations:


a. RST = 4 + 40 + 4 + 3 × 1 = 51 μs.

b. CST = 40 + 4 + 2 × 1 = 46 μs.

c. Data = 4 + 1 = 5 μs.
8

d. ACK = 0 μs. After the ACK is transmitted, there is no need for channel
reservation.

P15-19. We describe the procedure for each station:

a. Station A wins the contention and can start using the channel.
b. Station B needs to wait four slots and test the channel again. If the channel
is idle, it can use the channel; otherwise, it should start the procedure again.
c. Station C needs to wait 20 slots and test the channel again. If the channel is
idle, it can use the channel; otherwise, it should start the procedure again.

P15-21. We describe each IFS below:

a. The short interframe space (SIFS) is used to allow the two parties in a sin-
gle session to continue their transmission. This includes the time that a
party needs to send a CTS after receiving an RTS, sending an ACK after
receiving a data fragment, or sending the next fragment after receiving the
ACK for the previous fragment. It cannot be used to start a new session.
b. The base station that needs to send a beacon or poll frame (in PCF mode)
needs to wait for a PIFS period of time to do so. PIFS is longer than SIFS
to allow other stations to finish their sessions. However, if a time period of
SIFS elapses and the entitled station did not use its opportunity, the base
station can send its beacon or poll frame (after waiting PIFS) if it has one.
c. If a base station does not use its opportunity after PIFS time and a time
equal to DIFS elapses, a station using DCF can start a new dialog. You may
have noticed that PIFS is smaller than DIFS to give priority to the PCF sub-
layer.
d. An EIFS is normally used when there is an error in transmission and the
station needs to wait this period of time to report the situation. This period
is larger than the other ones to force the station to wait to see if the error is
corrected before an action. For example, if a station has received a wrong
frame, it needs to wait for a while to see if the correct frame will eventually
arrive.

P15-23. The address subfield in the header field is only 3 bits:

a. With a 3-bit address field, the address domain is in the range of 0 to 7.


b. Since the size of the address domain is only 8, we can have only 8 active
stations in a Bluetooth network.
CHAPTER 16

PRACTICE SET

Questions
Q16-1. WiMax defines a wireless WAN.

a. The fixed WiMax uses a star-topology to create a wireless WAN between a


base station (BS) and some fixed subscribed stations (FSubs).
b. The mobile WiMax also uses a star-topology to create a wireless WAN
between a base station (BS) and some mobile subscriber stations (MSubs).

Q16-3. This is the case of a mobile WiMax. The mobile phone communicates with a
mobile subscriber station (MSub).

Q16-5. A mobile switching center connects cells, records call information, and is
responsible for billing.

Q16-7. In a hard handoff, a mobile station communicates with only one base station.
In a soft handoff, a mobile station communicates with two base stations at the
same time.

Q16-9. D-AMPS is a digital cellular phone system that is backward compatible with
AMPS.

Q16-11. CDMA encodes each traffic channel using one of the rows in the Walsh-64
table.

Q16-13. A GEO satellite has an equatorial orbit since the satellite needs to remain
fixed at a certain spot above the earth.

Q16-15. A satellite orbiting in a Van Allen belt would be destroyed by the charged par-
ticles. Therefore, satellites need to orbit either above or below these belts.

Q16-17. GPS is a satellite system that provides land and sea navigation data for vehi-
cles and ships. The system is also used for clock synchronization.

1
2

Problems
P16-1. Let us assume that WiMax uses only TDM. In each time slot, a frame is in the
air. The base station fills the data to send to substation in the downstream sub-
frame; the substations fills the data to send to the base station in the upstream
subframe. Let us give a very simplified example to make the point clear.
Assume that the time slot is one minute and the communication is instanta-
neous. This means in each minute there is a frame in the air.

a. During the first half of each minute, the base station is sending data to the
substations and the substations are receiving data from the base station
(downstream communication).
b. During the second half of each minute, the substations are sending data to
the base station and the base station is receiving data from the substations
(upstream communication).

P16-3. The following figure shows one possibility.

5
5 2
2 1 3
1 3 4 5
4 5 2
5 2 1 3
2 1 3 4
1 3 4 5
4 5 2
2 1 3
1 3 4
4

P16-5. In AMPS, there are two separate bands for each direction in communication.
In each band, we have 416 analog channels. Out of this number, 21 channels
are reserved for control. With a reuse factor of 7, the maximum number of
simultaneous calls in each cell is

Maximum number of simultaneous calls = (416 − 21) / 7 = 56.4 ≈ 56

P16-7. In GSM, separate bands are assigned for each direction in communication.
This means 124 analog channels are available in each cell (assuming no con-
trol channels). Each analog channel carries 1 multiframe. Each multiframe
carries 26 frames (2 frames are for control). Each frame allows 8 calls. With a
reuse factor of 3, we have

Maximum number of simultaneous calls = [(124) × 24 × 8] / 3 = 7936


3

P16-9. A 3-KHz voice signal is modulated using FM to create a 30-KHz analog sig-
nal. As we learned in Chapter 5, the bandwidth required for FM can be deter-
mined from the bandwidth of the audio signal using the formula

BFM = 2(1 + β)B.

AMPS uses β + 1 = 5. This means BFM = 10 × B = 30 KHz.

P16-11. GPS satellites are orbiting at 18,000 km above the earth surface. Considering
the radius of the earth, the radius of the orbit is then (18,000 km + 6378 km) =
24,378 km. Using the Kepler formula, we have

Period = (1/100) (distance) 1.5 = (1/100) (24,378)1.5 = 38062 s = 10.58 hours

P16-13. Globalstar satellites are orbiting at 1400 km above the earth surface. Consid-
ering the radius of the earth, the radius of the orbit is then (1400 km + 6378
km) = 7778 km. Using the Kepler formula, we have

Period = (1/100) (distance) 1.5 = (1/100) (7778)1.5 = 6860 s = 1.9 hour

P16-15. In problem P16-6 we showed that the maximum simultaneous calls per cell
for D-APMS is 356. Using the total bandwidth of 50 MHz (for both direc-
tions), we have

Efficiency = 356 / 50 = 7.12 calls/MHz

P16-17. In problem P16-8, we showed that the maximum simultaneous calls per cell
for IS-95 is 1100. Using the total bandwidth of 50 MHz (for both directions),
we have

Efficiency = 1100 / 50 = 22 calls/MHz


CHAPTER 17

PRACTICE SET

Questions
Q17-1. An amplifier amplifies the signal, as well as noise that may come with the sig-
nal, whereas a repeater regenerates the signal, bit for bit, at the original
strength.

Q17-3. A transparent switch is a switch in which the stations are completely unaware
of the switch’s existence. If a switch is added or deleted from the system,
reconfiguration of the stations is unnecessary.

Q17-5. A forwarding port forwards a frame that it receives; a blocking port does not.

Q17-7. Members of a VLAN can send broadcast messages with the assurance that
users in other groups will not receive these messages.

Q17-9. Stations can be grouped by port number, MAC address, IP address, or by a


combination of these characteristics.

Q17-11. A router has more overhead than a switch.

a. A router process the packet at three layers; a switch processes a frame at


only two layers.

b. A router needs to search a routing table for finding the output port based on
the best route to the final destination; A switch needs only to consult a fil-
tering table based on the location of stations in a local network.

c. A routing table is normally longer than a filtering table; searching a routing


table needs more time than searching a filtering table.

d. A router changes the link-layer addresses; a switch does not.

1
2

Problems

P17-1.

a. A filtering table is based on the link-layer destination address of the arrived


frame.

b. A routing table is based on the network-layer destination address of the


arrived packet (datagram).

P17-3. See the following figure.

LAN 1 BC LAN 1
A A
B C B C

1 1 1 1
Addr Port Addr Port Addr Port Addr Port
B 1 B 1
2 2 2 2
E F E F

D D BC
LAN 2 LAN 2 BC

LAN 1 A BC LAN 1 A
BC
B C B C

1 1 1 1
Addr Port Addr Port Addr Port Addr Port
B 1 B 1 B 1 B 1
2 2 2 2
E F E F

D D BC
LAN 2 LAN 2 BC

P17-5. The looping problem comes from redundancy (two switches between the
LANs instead of just one). If we change the hub in both LANs, it reduces the
traffic in each LAN, but the switches between the two LANs still forward the
frame in both direction.
3

P17-7. The following figure shows one solution.

Root
1 1
0 S1 LAN 1 S2

1 2
1 LAN 2 S3 LAN 3
a. Spanning Tree

S1 LAN 1 S2

Blocking Blocking

LAN 2 S3 LAN 3
b. Logical connection with blocking port

P17-9. The router in this case acts as a link-layer switch and needs a link-layer
address.
CHAPTER 18

PRACTICE SET

Questions
Q18-1. The transport layer communication is between two ports; the network layer
communication is between two hosts. This means that each layer has a differ-
ent source/destination address pair; each layer needs a different header to
accommodate these pair of addresses. In addition, there are other pieces of
information that need to be separately added to the corresponding header.

Q18-3. Forwarding is delivery to the next node. A router uses its forwarding table to
send a packet out of one of its interfaces and to make it to reach to the next
node. In other words, forwarding is the decision a router makes to send a
packet out of one of its interfaces. Routing, on the other hand, is an end-to-end
delivery resulting in a path from the source to the destination for each packet.
This means a routing process is a series of forwarding processes. To enable
each router to perform its forwarding duty, routing protocols need to be run-
ning all of the time to provide updated information for forwarding tables.
Although forwarding is something we can see in the foreground, in the back-
ground, routing provides help to the routers to do forwarding.

Q18-5. The number of virtual circuits is 28 = 256.

Q18-7. None of these services are implemented for the IP protocol in order to make it
simple.

Q18-9. The throughput is the smallest transmission rate, or 140 Kbps. The bottleneck
is now the link between the source host and R1.

Q18-11. Yes. We can find the prefix length using only the block size. The prefix length
is directly related to the block size as shown below:

n = 32 − log2N

1
2

Problems
P18-1. The size of the address in each case is the base to the power of the number of
digits:

a. The size of the address space is 216 = 65,536.


b. The size of the address space is 166 = 16,777,216.
c. The size of the address space is 84 = 4096.

P18-3. We change each 8-bit section to the corresponding decimal value and insert
dots between the bytes.

a. 94.176.117.21
b. 137.142.208.49
c. 87.132.55.15

P18-5. The class can be defined by checking the first few bits (see figure 4.31). We
need to stop checking if we find a 0 bit or four bits have already been checked.

a. Since the first bit is 0, the Class is A.


b. Since the first four bits are 1110, the class is D.
c. Since the first three bits are 110, the class is C.

P18-7. We can use the formula N = 232− n

a. N = 232−0 = 4,294,967,296
b. N = 232−14 = 262,144
c. N = 232−32 = 1

P18-9. We can first write the prefix in binary and then change each 8-bit chunk to
decimal:

a. 00000000 00000000 00000000 00000000 mask: 0.0.0.0


b. 11111111 11111100 00000000 00000000 mask: 255.252.0.0
c. 11111111 11111111 11111111 11111100 mask: 255.252.255.252

P18-11. We first write each potential mask in binary notation and then check if it has a
contiguous number of 1s from the left followed by 0s.

a. 11111111 11100001 00000000 00000000 Not a mask


b. 11111111 11000000 00000000 00000000 A mask
3

c. 11111111 11111111 11111111 00000110 Not a mask

P18-13. We write the address in binary and then keep only the leftmost n bits.

a. 10101010 00101000 00001011


b. 01101110 00101000 111100
c. 01000110 00001110 00

P18-15. Both NAT and DHCP can be used for this purpose. DHCP dynamically
assigns one of the assigned addresses when a host needs to access the Internet;
NAT permanently assigns a set of private addresses to the host, but maps the
private address to the global address when a host needs to use the Internet.

P18-17. The total number of addresses is 212 = 4096. This means that there are 512
addresses for each network. We can divide the whole address space into eight
blocks (block 0 to block7), each of 512 addresses. The addresses in each block
are allocated as (0 to 511), (512 to 1023), (1024 to 1535), (1536 to 2047), …,
(3584 to 4095). It can be checked that each block is allocated according to the
two restrictions needed for the proper operation of CIDR. First, the number of
addresses in each block is a power of 2. Second, the first address is divisible
by the number of addresses as shown below:

Block 0: 0 / 512 = 0 Block 1: 512 / 512 = 1 Block 2: 1024 / 512 = 2 …

The prefix length for each group is ni = 12 − log2512 = 3. We can then write
the ranges in binary to find the prefix for each block.
Block Range Range in binary n Prefix
0 0 to 511 000000000000 to 000111111111 3 000
1 512 to 1023 001000000000 to 001111111111 3 001
2 1024 to 1535 010000000000 to 010111111111 3 010
3 1536 to 2047 011000000000 to 011111111111 3 011
4 2048 to 2559 100000000000 to 100111111111 3 100
5 2560 to 3071 101000000000 to 101111111111 3 101
6 3072 to 3583 110000000000 to 110111111111 3 110
7 3584 to 4095 111000000000 to 111110000000 3 111

The following figure shows the outline and the forwarding table. Note that
each interface can use one of the addresses in the corresponding block. The
addresses are written in decimal (not dotted-decimal) because of the address
space size.
4

Addresses: Addresses: Addresses: Addresses:


0 to 512 512 to 1023 1024 to 1535 1536 to 2047 Forwarding table
Prefix Interface
000 m0
0/3 512/3 1024/3 1536/3
m2 001 m1
m0 m1 m3 010 m2
m7 m4 011 m3
m6 m5 m4
000
2048/3 2560/3 3072/3 3584/3 000 m5
000 m6
000 m7
Addresses: Addresses: Addresses: Addresses:
2048 to 2559 2560 to 3071 3072 to 3583 3584 to 4095

P18-19. One way to do this is to first find the size of each block. We can then add the
size to the first address in the block to find the last address. Next, we can put
the blocks together to find whether they can be combined into a larger block.

Block Size First address Last address



a N = 2 26 = 64
32 16.27.24.0/26 → 16.27.24.63/26
b N = 232−26 = 64 16.27.24.64/26 → 16.27.24.127/26
c N= 232−25 = 128 16.27.24.128/25 → 16.27.24.255/26

Since the blocks are contiguous, we can combine the three blocks into a larger
one. The new block has 256 addresses and n = 32− log2256 = 24.
16.27.24.127/26
16.27.24.128/25

16.27.24.255/24
16.27.24.63/26
16.27.24.64/26
16.27.24.0/26

n:26 n:26 n:25


Original N:64 N:64 N:128
blocks
Block a Block b Block c
n:24
New block 16.27.24.0/24 N:256 16.27.24.255/24

P18-21.

a. The number of addresses in the ISP block is N = 232−20 = 4096. We can


add 4095 (which is N − 1) to the first address to find the last one (note that
the addition can be done in base 256, as described in Appendix B. In base
256, 4095 is (15.255). We have
First address: 16.12.64.0/20 Last address: 16.12.79.255/20
5

The prefix length for each organization is ni = 32 − log2 256 = 24. We


assume that the addresses are allocated from the beginning of the ISP block
with each organization consuming 256 addresses. The following shows
how addresses are allocated. Note that the prefix for each block is 24 bits.
Block First address Last address n
1 16.12.64.0/24 → 16.12.64.255/24 24
2 16.12.65.0/24 → 16.12.65.255/24 24
3 16.12.66.0/24 → 16.12.66.255/24 24
4 16.12.67.0/24 → 16.12.67.255/24 24
5 16.12.68.0/24 → 16.12.68.255/24 24
6 16.12.69.0/24 → 16.12.69.255/24 24
7 16.12.70.0/24 → 16.12.70.255/24 24
8 16.12.71.0/24 → 16.12.71.255/24 24
Unassigned 16.12.72.0/21 → 16.12.79.255/21 21
The unallocated addresses, which can be reserved for the future use of the
ISP, are 16.12.72.0/21 to 16.12.79.255/21, for a total of 2048 addresses.
b. The simplified outline is given below. Note that packets having destination
addresses with the last prefix in the figure are discarded until these
addresses are assigned.

Forwarding table
Org.: Organization m1
Prefix Interface
ISP Org. 1 Default m0
I.: Interface m2
Org. 2 0001000 00001100 01000000 m1
Dis.: Discard
m3 0001000 00001100 01000001 m2
Org. 3
m4 0001000 00001100 01000010 m3
m0 Org. 4
0001000 00001100 01000011 m4
Internet m5
Org. 5 0001000 00001100 01000100 m5
m6
Org. 6 0001000 00001100 01000101 m6
m7 0001000 00001100 01000110 m7
Dis. Org. 7
m8 0001000 00001100 01000111 m8
Org. 8
0001000 00001100 01001 Dis.

P18-23. The total number of addresses in the organization is N = 232−16 = 65,536.

a. Each subnet can have Nsub = 65,536 /1024 = 64 addresses.


b. The subnet prefix for each subnet is nsub = 32 − log2Nsub = 32 − 6 = 26.
c. Now we can calculate the first and the last address in the first subnet. The
first address is the beginning address of the block; the last address is the
first address plus 63.

First address: 130.56.0.0/26 Last address: 130.56.0.63/26


6

d. To find the first address in subnet 1024, we need to add 65,472 (1023 × 64)
in base 256 (0.0.255.192) to the first address in subnet 1. The last address
can then be found by adding 63 to the first.

First address: 130. 56.255.192/26 Last address: 130. 56.255.255/26

P18-25. The packet is sent to router R1 and eventually to organization 1 as shown


below:

a. Router R2 applies the mask /26 to the address (or it extracts the leftmost 26
bits) resulting in the network address/mask of 140.24.7.0/26, which does
not match with the first entry in the forwarding table.
b. Router R2 applies the mask /24 to the address (or it extracts the leftmost 24
bits) resulting in the network address/mask of 140.24.7.0/24, which
matches with the second entry in the forwarding table. The packet is sent
out from interface m0 to router R1.
c. Router R1 applies the mask /26 to the address (or it extracts the leftmost 26
bits) resulting in the network address/mask of 140.24.7.0/26, which
matches with the first entry in the forwarding table. The packet is sent out
from interface m0 to organization 1.
CHAPTER 19

PRACTICE SET

Questions
Q19-1. The minimum length of the IPv4 header is 20 bytes and the maximum is 60
bytes. The value of the header length field defines the header length in multi-
ples of four bytes, which means that HLEN can be between 5 and 15. It cannot
be less than 5 and it cannot be greater than 15. It is exactly 5 when there is no
option.

Q19-3. Since the fragmentation offset field shows the offset from the beginning of the
original datagram in multiples of 8 bytes, an offset of 100 indicates that the
first byte in this fragment is numbered 800, which means bytes numbered 0 to
799 (for a total of 800 bytes) were sent before.

Q19-5. The header length is 6 × 4 = 24. The option length is then 24 − 20 = 4 bytes.

Q19-7. The protocol field and the port numbers both have the same functionality:
multiplexing and demultiplexing. Port numbers are used to do these tasks at
the transport layer; the protocol field is used to do the same at the network
layer. We need only one protocol field at the network layer because payload
taken from a protocol at the source should be delivered to the same protocol at
the destination. The client and server processes, on the other hand, normally
have different port numbers (ephemeral and well-known), which means we
need two port numbers to define the processes. The size of the protocol field
defines the total number of different protocols that use the service of the net-
work layer, which is a small number (eight bits is enough for this purpose). On
the other hand, many new applications may by added every day that needs a
larger size of the port number field (sixteen bits is assigned).

Q19-9. Each datagram should have a unique identification number that distinguishes
it from other datagrams sent by the same source. The identification number is
copied into all fragments. In other words, the identification number glues all
fragments belonging to the same datagram together.

1
2

Q19-11. If this happens, we may enter a loop, a vicious circle. The first datagram is in
error; the second datagram reports error in the first. If the second datagram is
also in error, the third datagram will be carrying error information about the
second, and so.

Q19-13. These two messages need new fields and information that is not supported by
the ICMP protocol. A new application-layer client and server are needed to
send requests and receive responses. The designer of Mobile IP has decided to
implement it at the application layer instead of at the network layer, which
requires changes in this layer. UDP was selected instead of TCP as the trans-
port layer because of its lower overhead and because the messages exchanged
have clear boundaries and fixed size.

Q19-15. An ICMP solicitation message has all the necessary fields to be used as an
agent solicitation. No extra fields are needed.

Problems
P19-1. The total length of the datagram is (00A0)16 = 160 bytes. The header length is
5 × 4 = 20. The size of the payload is then 160 − 20 = 140. The efficiency =
140 / 160 = 87.5%.

P19-3. Using hexadecimal notations, we have

a. The wrapped sum can be found by adding the quotient and remainder when
dividing the sum by the modulus, which is 216 or (10000)16 in this case.
Note that the modulus is actually (FFFF + 1)16. Since the wrapped sum has
less than 8 digits (we can use the following steps); otherwise; we need a
loop to continuously find the quotient and remainder. Note that we use the
symbol (/) to define quotient and (%) to define remainder. All calculations
are in hexadecimal.

(Wrapped sum) = quotient + remainder


(Wrapped sum) = (sum) / (10000) + (sum) % (10000)
(Wrapped sum) = (1344E) / (10000) + (1344E) % (10000)
(Wrapped sum) = (1) + (344E) = 344F

b. The checksum can be calculated from the wrapped sum easily. All calcula-
tions are in hexadecimal.

(Checksum) = (modulus − 1) − (Wrapped Sum)


(Checksum) = (FFFF) − (344F) = CBB0
3

P19-5. We can calculate the sum, wrapped sum and checksum after each word if we
keep track of the sum in each step. The following shows the process. The
value of the last row in the last column shows the final checksum. All calcula-
tions are in decimal.

word sum wrapped sum checksum


17664 17664 17664 47871
28 17692 17692 47843
49153 66845 1310 64225
0 66845 1310 64225
1041 67886 2351 63184
0 67886 2351 63184
2572 70458 4923 60612
3589 74047 8512 57023
3078 77125 11590 53945
1801 78926 13391 52144

P19-7. In each case, we first need to think about the value of M and then the value of
the offset:

a. Since M = 1, it means there are more fragments and this is the first or mid-
dle; since the offset field is zero, it means this is the first fragment.
b. Since M = 1, it means there are more fragments and this the first or middle;
since the offset field is nonzero, it means this is a middle fragment.

P19-9. We show the value of each word in hexadecimal and then add them to get the
sum. Note the value of the sum in this case is less than FFFF + 1, so we do not
need to wrap the sum using quotient and remainder. We subtract the sum from
the FFFF to get the checksum.

Words Hex values


8&0 0800
0 0000
1 0001
9 0009
T&E 5445
S&T 5354
Sum AFA3
Checksum 505C

P19-11. Let us discuss each case separately:

a. Packet sniffing can be defeated if the datagram is encrypted at the source


and decrypted at the destination using an unbreakable scheme.
b. Packet modification can be defeated using a strong message integrity
scheme.
c. IP spoofing can be defeated using a strong entity authentication scheme.
4

P19-13. See the following figure:

ICMP
Advertisement Message
16 8 1456
10800 0 Reserved

P19-15. See the following figure:

ICMP
Advertisement Message
16 20 1672
14400 0 Reserved
128.1.1.2
128.1.1.3
128.1.1.4
CHAPTER 20

PRACTICE SET

Questions
Q20-1. According to the principle we mentioned in the text, the shortest path is the
inverse of the original one. The shortest path is G → E → B → A.

Q20-3. Link-state routing uses Dijkstra’s algorithm to first create the shortest-path
tree before creating the forwarding table. The algorithm needs to have the
complete LSDB to start.

Q20-5. The three ASs described in the text are stub, multihomed, and transient. The
first two do not allow transient traffic; the third does. The stub and multi-
homed ASs are similar in that they are either the sink or source of traffic; the
first is connected to only one other AS, but the second is connected to more
than one ASs.

Q20-7. The source and destination IP addresses in datagrams carrying payloads


between the hosts are the IP addresses of the hosts; the IP addresses carrying
routing update packets between routers are IP addresses of the routing inter-
faces from which the packets are sent or received. This shows that a router
needs as many IP addresses as it has interfaces.

Q20-9. Although RIP is running as a process using the service of the UDP, the process
is called a daemon because it is running all the time in the background. Each
router acts both as a client and a server; it acts as a client when there is a mes-
sage to send; it acts as a server when a message arrives.

Q20-11. OSPF divides an AS into areas, in which routing in each area is independent
from the others; the areas only exchange a summary of routing information
between them. RIP, on the other hand, considers the whole AS as one single
entity.

Q20-13. In RIP, each router just needs to share its distance vector with its neighbor.
Since each router has one type of distance vector, we need only one update
message. In OSPF, each router needs to share the state of its links with every
other router. Since a router can have several types of links (a router link, a net-
work link, …), we need several update messages.

1
2

Q20-15. The type of payload can be determined from the value of the protocol field.
The protocol field value for ICMP is 01; for OSPF, it is 89.

Q20-17. It cannot. A link needs to be advertised in a router link LSP; a network needs
to be advertised in a network link LSP.

Q20-19. BGP is designed to create semi-permanent communication between two BGP


speakers; this requires the service of TCP. A connection is made between the
two speakers and remains open, while the messages are exchanged between
them. UDP cannot provide such a service.

Q20-21. The following shows the use of each attribute:

a. The LOCAL-PREF is used to implement the organization policy.


b. The AS-PATH defines the list of autonomous systems through which the
destination can be reached.
c. The NEXT-HOP defines the next router to which the data packet should be
forwarded.

Problems
P20-1. We have

Dxy = min {(cxa + Day), (cxb + Dby), (cxc + Dcy), (cxd + Ddy)}

Dxy = min {(2 + 5), (1 + 6), (3 + 4), (1 + 3)} = min {7, 7, 7, 4} = 4

P20-3.

a. The hello message (type 1) is used by a router to introduce itself to neigh-


boring routers and to introduce already-known neighboring routers to other
neighbors.
b. The data description message (type 2) is sent in response to a hello mes-
sage. A router sends its full LSDB to the newly joined router.
c. The link-state request message (type 3) is sent by a router that needs infor-
mation about a specific LS.
d. The link-state update message (type 4) is sent by a router to other routers
for building the LSDB. There are five different versions of this message to
announce different link states.
e. The link-state acknowledge message (type 5) is sent by a router to
announce the receiving of a link-state update message. This message is
used to provide reliability for the main message used in OSFP.
3

P20-5. Two nodes, A and D, see the changes. These two nodes update their vectors
immediately. We assume that changes in each round are fired in the order A,
B, C, D. The following shows that the internet is actually stable after two
rounds of updates, but more updates are fired to assure the system is stable.
We have shown only three columns for each forwarding table, but RIP usually
uses more than columns. Also note that we have used the yellow color to show
the changed in cost field, which triggers updates. The cost and the next hop
fields participate in updating.

Cost Change in cost Next hop

A B C D

Changes A 0 A A 3 B A 5 B A 1 D
occured B 3 A B 0 B B 2 C B 5 D
C 5 B C 2 B C 0 C C 4 D
in the links. D D 5 D 0 D
1 D B D 4 C
1 2

+3 +1

A sends A 0 B A 3 B A 5 B A 1 D
B 3 C B 0 B B 2 C B 4 A
updates to C 4 D
C 5 C C 2 B C 0 C
B and D. D 1 D 4 A D 4 D 0 D
C C

+1 +5 +4

D sends A 0 B A 3 B A 5 B A 1 D
updates to B 3 C B 0 B B 2 C B 4 A
A, B, and C. C 5 C C 2 B C 0 C C 4 D
D 1 C D 4 A D 4 C D 0 D

P20-7. The number of operations in each iteration of the algorithm is n, in which n is


the number of nodes in the network. In computer science, this complexity is
written as O(n) and is referred to as Big-O notation.

P20-9. The following shows the advertisement in each case (a triplet defines the des-
tination, cost, and the next hop):

a. From A to B: (A, 0, A), (C, 4, A).


b. From C to D: (A, 4, C), (C, 0, C).
c. From D to B: (C, 6, D), (D, 0, D).
4

d. From C to A: (B, 8, D), (C, 0, C), (D, 6, C).

P20-11. The forwarding table for node A can be made using the least-cost tree, as
shown below:

Destination Cost Next hop


A 0
B 2
C 7 B
Forwarding table D 3
for node A E 6 B
F 8 B
G 9 B

P20-13. The following shows the steps to create the shortest path tree for node B and
the forwarding table for this node.

2 0 5 2 0 5
A B C A B C

G G
8

8
D E F D E F
8

8
8

5 4
Initialization Iteration 1

2 0 5 2 0 5
A B C A B C

G G
8
8

D E F D E F
5 4 6 5 4 6
Iteration 2 Iteration 3

2 0 5 2 0 5
A B C A B C

G G
8 8
D E F D E F
5 4 6 5 4 6
Iteration 4 Iteration 5

Destination Cost Next hop


2 0 5 A 2
A B C B 0
C 5
G D 5 A
7 E 4
D E F
F 6 E
5 4 6
G 8 E
Iteration 6
Forwarding table for node B
5

P20-15. The number of searches in each iteration of Dijkstra’s algorithm is different.


In the first iteration, we need n number of searches, in the second iteration, we
need (n − 1), and finally in the last iteration, we need only one. In other words,
the total number of searches for each node to find its own shortest-path tree is

Number of searches = n + n − 1 + n − 2 + n − 3 + … + 3 + 2 + 1 = n (n + 1) / 2

The series can be calculated if it is written twice: once in order and once in the
reverse order. We then have n items, each of value (n + 1), which results in n(n
+ 1). However, we need to divide the result by 2. In computer science, this
complexity is written as O(n2) and is referred to as Big-O notation.

P20-17. Router R1, using its OSPF forwarding table, knows how to forward a packet
destined for N4. R1 announces this reachability to R5 using an eBGP session.
R5 adds an entry to its RIP forwarding table that shows R1 as the next router
for any packet destined for N4.
CHAPTER 21

PRACTICE SET

Questions
Q21-1. In multicasting, the sender host sends only one copy of the message, but it is
multiplied at the routers if needed; all multiplied copies have the same desti-
nation address. In multiple-unicasting, the sender host sends one copy for each
destination; each copy has its own destination address.

Q21-3. The multicast address block is 224.0.0.0/4. In other words, a multicast address
is between 224.0.0.0 and 239.255.255.255. Based on this criteria we have

a. A multicast b. A multicast c. Not a multicast

Q21-5. If a host is a member of N multicast group, it will have N multicast addresses.

Q21-7.

a. In unicast communication, the destination is only one of the leaves of the


tree in each transmission.
b. In multicast communication, the destination may be one or more leaves of
the tree in each transmission.

Q21-9. DVMRP allows a router to create the shortest path-tree whenever it receives a
multicast packet (on demand).

a. The number of shortest-path trees in DVMRP that use the source-based


approach is huge.
b. If each router created all of the required multicast shortest-path trees, it
would be a huge overhead.

Q21-11. RPB creates a broadcast shortest path tree with the source as the root and net-
works as the leaves. In other words, it tries a shortest path from the source to
every network assuming that all networks are interested to receive that partic-
ular group message.
1
2

Q21-13. Each router using DVMRP creates the shortest-path three in three steps:

a. In the first step, the router uses the RPF algorithm to keep only packets that
have arrived from the source using the shortest-path three. In other words,
the first part of the tree is made using the RPF algorithm.
b. In the second step, the router uses the RPB algorithm to create a broadcast
tree.
c. In the third step, the router use the RPM algorithm to change the broadcast
tree created in the second step to a multicast tree.

Q21-15. Every multicast routing algorithm needs to somehow use a unicast protocol in
its operation. For example, DVMRP needs to use RIP and MOSPF needs to
use OSPF. Although PIM also needs to use a unicast protocol, the protocol can
be either RIP or OSPF.

Q21-17. In PIM-DM, it is assumed that most networks have a loyal member in each
group, so it does not matter if the first packet reaches all networks. In PIM-
SM, it is assumed that a few networks has a loyal member in each group, so
broadcasting is wasting the bandwidth.

Problems
P21-1. We define two properties for a block in classless addressing. The first address
needs to divide the number of addresses in the block. The number of addresses
in the block should also be a power of 2. Let us check these properties for
these two blocks (two applets for chapter 4 can easily find the values).

a. In the first block, the value of the first address is 3,758,096,895 and the
number of addresses in the block is 65,024. None of the conditions meet.
The block is intended to be split in the future.
b. In the second block, the value of the first address is 3,758,292,992 and the
number of addresses in the block is 134,021,120. None of the conditions
meet. The block is intended to be split in the future.
c. In the third block, the value of the first address is 3,925,868,544 and the
number of addresses in the block is 83,886,080. None of the conditions
meet. The block is intended to be split in the future.
3

P21-3. We use binary notation to do transformation:


11011111 00011000 00111100 00001001
↓ ↓ ↓
00000001 00000000 01011110 00011000 00111100 00001001

The resulting address in hexadecimal is: 01:00:5E:18:3C:09. Using the same


method, we get the same result.

P21-5. There is no need for a report message to travel outside of its own network
because its only purpose is to inform the next router in the spanning tree of
group membership. There is no need for a query message to travel outside of
the local network because its only purpose is to poll the local network for
membership in any groups.

P21-7. Please correct the errors in this problem using the errata. Since router B tells
that the source is 4 hops away, router B needs to be selected as the designated
router.

P21-9. The following show the shortest path from the source and the shortest path
tree seen from router R.

Root 3
S

R
4 7
a. Shortest path tree seen by router S

b. Shortest path tree seen by router R


CHAPTER 22

PRACTICE SET

Questions
Q22-1. We can say (1) larger address space, (2) better header format, (3) new options,
(4) allowance for extension, (5) support for resource allocation, and (6) sup-
port for more security.

Q22-3. A compatible address is an address of 96 bits of 0s followed by 32 bits of an


IPv4 address. A mapped address is an address of 80 bits of 0s followed by 16
bits of 1s and followed by 32 bits of an IPv4 address. A compatible address is
used when a computer using IPv6 wants to send a packet to another computer
using IPv6. A mapped address is used when a computer using IPv6 wants to
send a packet to a computer still using IPv4.

Q22-5. The IP header is included because it contains the IP address of the original
source. The first 8 bytes of the data are included because they contain the first
section of the TCP or UDP header which contains information about the port
numbers (TCP and UDP) and sequence number (TCP). This information
allows the source to direct the ICMP message to the correct application.

Q22-7. The prefix length is 3, which means the size of the block is

N = 2128−3 = 2125 A very large block

Q22-9. The prefix length is 7, which means the size of the block is

N = 2128−7 = 2121 A very large block

Q22-11. Autoconfiguration allows the DHCP to automatically allocate an IP address to


a host when the host joins the network.

Q22-13. The next header field is responsible for multiplexing and demultiplexing in
IPv6. It is similar to the protocol field in IPv4.

1
2

Q22-15.

a. The neighbor-solicitation message in ICMPv6 replaces the ARP request


message in version 4.

b. The neighbor-advertisement message in ICMPv6 replaces the ARP


response message in version 4.

Q22-17. We need to encapsulate IPv6 packets in IPv4 packets in the tunneling strategy.

Problems
P22-1. The following table shows the comparison:

Field IPv4 IPv6


VER √ √
HLEN √
Service (or traffic class) √ √
Flow label √
Total length √
Payload length √
Identification √
Flags √
Flag offset √
TTL (or hop limit) √ √
Protocol √
Checksum √
Source Address √ √
Destination Address √ √

P22-3.

a. 0:FFFF:FFFF::
b. 1234:2346:3456::FFFF
c. 0:1::FFFF:1200:1000
d. ::FFFF:FFFF: 24.123.12.6

P22-5.

a. 0000 :0000:0000:0000:0000:0000:0000:0002
b. 0000:0023:0000:0000:0000:0000:0000:0000
c. 0000:000A:0000:0000:0000:0000:0000:0003
3

P22-7. Both subnets keep the given global routing prefix. Each subnet adds a 16-bit
subnet identifier. We assume the subnet identifiers start from (0001)16, but
they can also start from (0000)16.

a. The first subnet block is 2000:1234:1423:0001/64.


b. The second subnet block is 2000:1234:1423:0002/64.

P22-9. We change the seventh bits from 0 to 1 (F5 is changed to F7) and insert four
extra hexadecimal digits (FF-FE) after the sixth digits:
F5 - A9 - 23 - 12 - 7A - B2
F7 - A9 - 23 - FF - FE - 12 - 7A - B2

The resulting preface address in IPv6 is F7A9:23FF:FE12:7AB2.

P22-11. The address is ::129.6.12.34/128.

P22-13. The address is ::01/128.

P22-15. Here we mean unique local unicast address (see the errata). The prefix in this
case is FC00/7. After adding the suffix (0::123/48), we can get the unique
local unique address as FC::123/48.

P22-17. See the following figure.

6 0 3245
0 0 15
581E:14562314:ABCD::1211

581E:1456:2314:ABCD::2211

6 8 194 4
128020
60333 25
345
Checksum
7
5 Reserved 0 8192
Checksum 0
128000 bytes of data
4

P22-19. The error-reporting messages in ICMPv4 and ICMPv6 are similar except that
some messages have been totally deleted in version 6 or has been inserted in
other categories. The following table shows a comparison.

Message v4 v6 Explanation
Destination unreachable √ √
Source quench √ Deleted from ICMPv6; rarely used
Time exceeded √ √
Parameter problem √ √
Redirection √ Moved to neighbor-discovery category
Packet too big √ Added in v6 to prevent big-packet size

P22-21. The neighbor-discovery category is new in ICMPv6. In ICMPv4, one of these


messages belonged to another category; the duties of others were covered by
other protocols, The following table shows a comparison.

Message v4 v6 Explanation
Router solicitation √ Version 4 uses DHCP for this purpose
Router advertisement √ Version 4 uses DHCP for this purpose
Neighbor solicitation √ Version 4 uses ARP request packet
Neighbor advertisement √ Version 4 uses ARP reply packet
Redirection √ Included in error-reporting group in v4

P22-23. Group membership messages are new in Version 6. Version 4 is using IGMP
protocol for this purpose. The following table shows a comparison.

Message v4 v6 Explanation
Membership query √ It was part of IGMP protocol in v4.
Membership report √ It was part of IGMP protocol in v4.
CHAPTER 23

PRACTICE SET

Questions
Q23-1. The answer is no. Host-to-host and process-to-process communication are
needed because each computer in the Internet is designed to do multiple tasks:
to run multiple application-layer programs.

Q23-3. Although any port number can be used for the client and server and they can
be the same in this private communication, it is recommended to follow the
division specified by ICANN:

a. The client port number should be chosen from the dynamic range, 49,152
to 65,535.
b. The server port number also should be chosen from the dynamic range,
49,152 to 65,535.
c. It is advisable to choose different port numbers for the server and the client
to be able to better debug the programs.

Q23-5. We check each protocol one by one:

a. The protocol can be Stop-and-Wait with the receive window size of 1 and
the send window size of 1.
b. The protocol can also be Go-Back-N with the receive window size of 1 and
the send window size of n packets.
c. The protocol cannot be Selective-Repeat because the size of both windows
should be the same (1), which means the protocol is Stop-and-Wait, not
Selective-Repeat.

Q23-7. We describe the advantage and disadvantage of each first:

a. The advantage of using the Go-Back-N protocol is that we can have a


larger send window size. We can send more packets before waiting for their
acknowledgment. The disadvantage of using this protocol is that the
receive window size is only 1. The receiver cannot accept and store the out-
of-order received packets; they will be discarded. Discarding of the out-of-

1
2

order packets means resending these packets by the sender, resulting in


congestion of the network and reducing the capacity of the pipe. So the
advantage seen by a larger send window may disappear by filling the net-
work with resent packets.
b. The advantage of using the Selective-Repeat protocol is that the receive
window can be much larger than 1. This allows the receive window to store
the out-of-order packets and avoids resending them to congest the network.
The disadvantage of this protocol is that the send window size is half of the
Go-Back-N, which means that we can send fewer packets before waiting
for the acknowledgment.
We can conclude that if the bandwidth-delay product of the network is large,
the reliability is good, and the delay is low, we should choose the Go-Back-N
protocol to use more of the network capacity. On the other hand, if the band-
width-delay product is small, or the network is not very reliable, or the net-
work creates long delays, we need to use Selective-Repeat.

Q23-9. The networks need to be carefully designed to make the time between the two
wraparounds as long as possible. For example, in a protocol that uses the
sequence number field of size 3 (m = 3), every 2m = 8 packets have the same
sequence number. If the previous packet with sequence number x (or its acci-
dentally created duplicate) is still wandering in the network arrives at the des-
tination, the receiver may confuse this with the expected new packet, also with
sequence number x.

Q2311. The transport-layer packets are encapsulated in the datagram at the network
layer. The router through which the datagrams need to pass to reach their des-
tination may be congested and drop the packets.

Q23-13. The rest of the packets (2m − 2) are supposed to be in transit, filling the pipe.
The size of the receive window is chosen to be 1 to accept only one packet, the
one expected, and not out-of order packets. The receiver cannot be over-
whelmed because it holds only one packet in its window. When the only
packet in the window is consumed by the upper-layer protocol, the receive
window slides to make it possible to receive the next packet in transit. If any
packet in transit arrives before the window slides, it is discarded.

Problems
P23-1. The domain of IP addresses is universal. A device directly connected to the
Internet needs a unique IP address. The domain of port numbers is local; they
can be repeated. Two computers running the HTTP server process use the
same well-known port number (80); two computers running the HTTP client
process can use the same ephemeral port number.

P23-3. The sequence number of any packet can be found using the following relation:
3

seqNo = (starting segNo + packet number −1) mod 2m

in which m is the number of bits used to define the sequence number. The
sequence number in this case is
seqNo = (0 + 100 − 1) mod 25 = 99 mod 32 = 3

P23-5.

Protocol Max Send Wsize Max Receive Wsize


Stop-and-Wait: 1 1
Go-Back-N: 25 − 1 = 31 1
Selective-Repeat: 25 / 2 = 16 25 / 2 = 16

P23-7. The following figure shows the states and events. The sender needs two states:
ready and blocking. The receiver also needs these two states. To send a packet,
the sender should be in the ready state and receives data from the application
layer. The receiver accepts a packet from the sender when it is in the ready
state. When the receiver becomes ready, it sends an ACK packet and moves to
the ready state.

Request came from application. A packet arrived.


Make a packet and send it. Inform the application layer.

Ready Blocking Ready Blocking

Start Start Ready to receive another packet.


An ACK arrived.
Do nothing. Send an ACK.

Sender Receiver

P23-9. The following figure shows the case. It happens when an ACK is delayed and
the time-out occurs. The sender resends the packet that is already acknowl-
edged by the receiver. The receiver discards the duplicate packet, but resends
the previous ACK to inform the sender that there is a delay in the network.

Sender Transport Transport Receiver


layer layer
Packet 0
Start

Time-out Packet 0 ACK 1

Stop Discards
ACK 1 (it is duplicate)

Duplicate
ACKs received
(maybe time-out
occured too soon) Time Time
4

P23-11. The figure on the next page shows the outline. Note that since the simple pro-
tocol provides no error control, if a packet is lost, the receiving process is
responsible for finding a solution. The transport layer is not even aware that
this has happened. The packets may also be delivered out of order to the
receiving process. The responsibility again is on the receiving process to reor-
der the packets.

Sender Receiver
Transport Transport
layer layer

Req Packet 0
Packet 1 pArr
Req
Req Packet 2 pArr

Req Packe
t3 Lost
Packet 4
Req
pArr
pArr

Time Time

P23-13. See the following figure:

Transport Transport Receiver


Sender layer layer
Req Packet 0
Start 0 1 0 1 0 1
pArr
ACK 1 0 1 0 1 0 1

Timeout; T-Out Packet 0 (res


restart 0 1 0 1 0 1 ent)
pArr Packet 0
ACK 1 discarded
aArr (a duplicate)
Stop 0 1 0 1 0 1

Req Packet 1
Start 0 1 0 1 0 1
Lost
Timeout; T-Out
0 1 0 1 0 1 Packet 1 (resent)
restart pArr
ACK 0 0 1 0 1 0 1
aArr
Stop 0 1 0 1 0 1

Time Time
5

P23-15. The following figure shows the solutions:

Events:
Req: Request from process
pArr: Packet arrival Sender Receiver
aArr: ACK arrival
Transport Transport
T-Out: time out layer layer
Sf Sn Rn
Initial 0 1 2 3 4 5 6 7 0 Initial 0 1 2 3 4 5 6 7 0
Sf Sn
Req Packet 0 Rn
Start 0 1 2 3 4 5 6 7 0 pArr
0 1 2 3 4 5 6 7 0
Sf Sn ACK 0
Stop aArr Data delivered
0 1 2 3 4 5 6 7 0 to application
Sf Sn Rn
Req Packet 1
Start 0 1 2 3 4 5 6 7 0 pArr
0 1 2 3 4 5 6 7 0
Sf Sn ACK 1
aArr Data delivered
Stop 0 1 2 3 4 5 6 7 0 to application
Sf Sn Rn
Req Packet 2
Start 0 1 2 3 4 5 6 7 0 pArr
0 1 2 3 4 5 6 7 0
Sf Sn ACK 2
Stop aArr
0 1 2 3 4 5 6 7 0
Data delivered
Sf Sn to application
Req Pa
Start 0 1 2 3 4 5 6 7 0 ck
et
3
Sf Sn Rn
Req Packet 4
0 1 2 3 4 5 6 7 0 pArr
0 1 2 3 4 5 6 7 0
Sf Sn ACK 4
Restart
aArr Rn
0 1 2 3 4 5 6 7 0
pArr
0 1 2 3 4 5 6 7 0
Sf Sn ACK 3
aArr
Stop 0 1 2 3 4 5 6 7 0
Data delivered
Time Time to application

P23-17. We assume each event is independent.

a. seqNo = 15.
b. Five packets with seqNos set to 10, 11, 12, 13, and 14 are to be resent.
c. Sf = 13 and Sn = 15.
d. The size of the window remains the same. Max Wsize = 64 − 1 = 63.
e. Sf = 18 and Sn = 21. Next state = ready.
f. Rn = 17. Action: message is delivered and an ACK with ackNo = 17 is sent.

P23-19. In each case we first define the bandwidth-delay product (BDP) in bits and
then find it in the number of packets:

a. BDP = 1 Mbps × 20 ms = 20,000 bits = 20 packets


6

b. BDP = 10 Mbps × 20 ms = 200,000 bits = 100 packets


c. BDP = 1 Gbps × 4 ms = 4,000,000 bits = 400 packets

P23-21. We first calculate the average round-trip time (RTT) and the number of pack-
ets in the pipe before finding the sizes of the windows, the value of m, and the
time-out value.

a. Average RTT = 2 × (5,000 Km) / (2 × 108) = 50 ms.


b. The bandwidth-delay product = 1 Gbps × 50 ms = 50,000,000 bits.
c. The bandwidth-delay product = 50,000,000 bits / 50,000 bits = 1000 pack-
ets.
d. The maximum send window size should be 1000 to allow not more than
1000 packets in the pipe.
e. The maximum receive window size should also be 1000 packets.
f. We know that the (window size) ≤ (2m − 1) or 1000 ≤ (2m − 1). This means
that we need to choose (m − 1) to be at least 10 or m = 11. The sequence
numbers are then 0 to 2047.
g. The timeout value should be at least the average RTT = 50 ms to avoid
early retransmission of the packets and to prevent congestion.

P23-23. The following figure shows the situation.

Sf Sn Rn

62 63 64 65 66 67 68 64
Sender Receiver

a. If the receiver expects a packet with sequence number 64 and packets with
sequence numbers 62 to 65 are already sent but not acknowledged, it
means that two packets with sequence numbers 64 and 65 are in transit
from the sender to the receiver.
b. If the sender expects the acknowledgment for packet 62, but the value of Rn
= 64, it means that the ACK packets with acknowledgment numbers 62 and
63 are in transit from the receiver to the sender.
CHAPTER 24

PRACTICE SET

Questions
Q24-1. The protocol field of the datagram defines the transport-layer protocol that
should receive the transport-layer packet. If the value is 06, the protocol is
TCP; if the value is 17, the protocol is UDP.

Q24-3. UDP is preferred because each user datagram can be used for each chunk of
data.

Q24-5. The answer is positive. There is nothing in the UDP or TCP protocol that
requires the use of the IP protocol. A UDP user datagram or a TCP segment
can be encapsulated in an Ethernet frame. However, the protocol field of the
Ethernet needs to define which protocol is directly used in this case.

Q24-7. The SYN segment cannot carry data. The SYN + ACK segment cannot carry
data either, but this segment is actually the SYN segment with an additional
ACK bit. Although some people think that the FIN segment may not carry
data, it actually can. The client or the server can send the last bytes of data in a
segment and set the FIN bit.

Q24-9. We find the sequence number of the second segment in each case:

a. The sequence number of the second segment is 101 + 0 = 101.


b. The sequence number of the second segment is 101 + 10 = 111.

Q24-11. A segment that should be unambiguously acknowledged needs to consume a


sequence number; otherwise, the segment and the next one have the same
sequence number and it is not clear to which segment the acknowledgment
belongs.

a. A SYN segment needs to be acknowledged unambiguously because it


opens the connection.
b. A SYN + ACK is actually a combination of two segments; the first embed-
ded segment, which is a SYN, needs to be acknowledged.

1
2

c. A FIN segment needs to be acknowledged unambiguously because it sig-


nals closing of a connection.
d. An ACK segment that carries no data is never acknowledged (no ACK for
an ACK). It, therefore, does not consume a sequence number.

Q24-13. The window size field of the TCP header is only 16 bits. A number with 16
bits can define a decimal number between 0 and 65,535.

Q24-15. A SYN segment opens the connection in only one direction. For a communi-
cation using TCP, two SYN segments are needed, one for each direction.

Q24-17. A segment carrying an RST flag can close the communication in both direc-
tions immediately. The segment carrying an RST flag should not even be
acknowledged.

Q24-19. The server needs to immediately send a segment with the RST flag set to show
that the connection cannot be established. As we see in Chapter 19, if the net-
work layer knows about the availability, it can also send an ICMP packet.

Q24-21. A connection identifier in this case needs to include the identifier for two end
points. In this case, a unique identifier for each end is defined by a socket
address. The connection identifier should therefore be a pair of socket
addresses: the source socket address and the destination socket address.

Q24-23. In this case, Bob has made a passive open connection when he publicly
announced his telephone number or privately gave his telephone number to
Alice. Alice makes an active open when she dials Bob’s telephone number.

Q24-25. A TCP segment or a combination of two or more segments can perform one of
the following tasks:

a. Establishing a connection
b. Terminating a connection
c. Transferring data
d. Acknowledging the receipt of a segment
e. Advertising the window size (rwnd)

Q24-27. The acknowledgment identifies the sequence number of the next segment that
is expected to arrive.

Q24-29. The TCP server has received a segment whose sequence number is higher
than expected. The TCP server should store the out-of-order segment and send
an ACK with acknowledgment number 2001 to lead to the generation of a
3

duplicate acknowledgment and possibly the fast retransmission of the missing


segment (Rule 4 in ACK generation).

Q24-31. The server needs to store the bytes in the buffer and sends an ACK with
sequence number 2401. This reaction helps the client to purge the correspond-
ing segment from its queue (Rule 5 in ACK generation).

Q24-33. The client needs to store the new bytes, but delay the acknowledgment until
receiving the next segment or wait a period of 500 ms. This reduces the num-
ber of ACKs in the network. (Rule 2 in ACK generation).

Q24-35. Figures 24.22 and 24.23 define the FSMs for unidirectional communication.
The first rule of ACK generation is for bidirectional communication. It is the
interaction between the sender and receiver TCP at each end. The rule should
be implemented in the software.

Q24-37. The six rules we mentioned for ACK generation are related to flow and error
control and are applicable during the data transmission phase, not the connec-
tion establishment phase. In this case, if the client accepts the connection, it
needs to send an ACK segment immediately or a data segment that acknowl-
edges the SYN + ACK segment. Otherwise, it needs to send an RST segment
and abort the connection.

Q24-39.

general header 12 bytes


DATA chunk #1 header 16 bytes
DATA chunk #1 22 bytes
padding 2 bytes
DATA chunk #2 header 16 bytes
DATA chunk #2 22 bytes
padding 16 bytes
Total 92 bytes

Q24-41.

general header 12 bytes


COOKIE-ECHO chunk 204 bytes
DATA chunk 36 bytes
Total 252 bytes

Q24-43. The SACK chunk with a cumTSN of 23 was delayed.


4

Problems
P24-1.

a. The minimum size is 8 bytes (header without payload).


b. Although the theoretical maximum size is 65,535 bytes, since a user data-
gram needs to be encapsulated in a single IP datagram (UDP is a connec-
tionless protocol) and the maximum payload of an IP datagram is 65,515
bytes (see Chapter 19), we should say the maximum size of a UDP data-
gram is only 65,515 bytes.
c. The minimum size of the application-layer payload is zero bytes.
d. The maximum size of the application-layer payload is 65,507 bytes
(65,515 − 8).

P24-3.

a. The source port number is the first 16 bits or (0045)16 = 69.


b. The destination port number is the second 16 bits (DF00)16 = 57,088.
c. The total length of the datagram is the third 16 bits (0058)16 = 88 bytes.
d. The length of the data is 88 − 8 = 80 bytes.
e. The message is from a server with a small (well-known) port number to a
client with a large (ephemeral) port number.
f. The well-known port number 69 belongs to TFTP.
g. The sender has not calculated the checksum for this packet because the
value of the checksum is all zeros.

P24-5. The number (0111)2 in decimal is 7. The total length of the header is then (7 ×
4) = 28. The base header is 20 bytes. The segment has 28 − 20 = 8 bytes of
options.

P24-7. The following are eight out of 64 possible combinations that are normally
used:
000000 → A data segment with no acknowledgment
110000 → A data segment with urgent data and acknowledgment
010000 → An ACK segment with or without data
000010 → A SYN segment
011000 → A data segment with push data and acknowledgment
000001 → A FIN segment
010010 → An ACK + SYN segment
000100 → An RST segment
5

P24-9. Even with three letters exchanged between Alice and Bob, there is no guaran-
tee that both know where and when they should meet. However, more and
more communication raises the probability that both parties know about the
meeting. Experts believe that three communications between the two parties
are adequate assurance that they can come to the meeting. Let us go through
each event:

a. Alice cannot go to the meeting because she is not sure that Bob has
received the letter. The letter may have been lost and Bob knows nothing
about the meeting. This is similar to sending a SYN segment from the cli-
ent to the server. The client (Alice) sets the scenario.

b. Bob cannot go to the meeting because he does know if Alice has received
his confirmation. This is similar to the SYN + ACK. The server (Bob) con-
firms Alice’s request.

c. Alice cannot go to the meeting with total assurance that Bob will be there
because she does not know if Bob has received her letter and knows that
she knows that the meeting is confirmed. This is similar to the last ACK.
The client (Alice) confirms that she has received the confirmation from the
server (Bob).

P24-11.

a. The sequence number in the SYN segment is 2171. The SYN segment con-
sumes one sequence number; the next sequence number to be used is 2172.

b. The sequence number in the data segment is 2172 (which represents the
sequence number of the first byte). The bytes in the packets are numbered
2172 to 3171. Note that the client sends the data with the second packet (no
separate ACK segment).

a. The sequence number in the FIN segment is 3172. Note that the FIN seg-
ment does consume a sequence number, but it needs a sequence number to
be acknowledged.

P24-13. The data section is only 16 bytes. The TCP header is 20 bytes. The efficiency
is

(16) / (16 + 20) = 0.444 → 44.4%


6

P24-15. The following shows the three segments exchanged:

Client SYN Segment Server


59,100 80
14,534
1 785
5 0 00 0 10
Checksum
SYN + ACK Segment
80 59100 59,100
21,732
785
14,535 2
5 0 10 0 10 5000
Checksum

ACK Segment
59,100 80
14534
14,535
3 785
21,733
5 0 10 0 00 4000
Time Checksum Time

P24-17. The following figure shows the connection termination phase. We assume a
three-handshake connection termination because the server has no more data
to send.

Client
FIN + ACK Segment
Server
59,100 80
14,635
1 785
22,933
5 0 1 0 0 01 0
Checksum
FIN + ACK Segment
80 59100 59,100
22,933
785
14,536 2
5 0 10 00 1 0
Checksum

ACK Segment
59,100 80
14534
14,636
3 785
22,934
5 0 10 0 00 0
Time Checksum Time
7

P24-19. The following figure shows the new diagram.

CLOSED CLOSED
ACK / –
Time-out / – Passive open / _
TIME-WAIT
TIME-WAIT Active open / SYN
LISTEN
LISTEN LAST-ACK
LAST-ACK

SNY-SENT
SNY-SENT
FIN + ACK / ACK SYN / SYN + ACK Close / FIN + ACK

SYN + ACK / ACK SYN-RCVD


SYN-RCVD CLOSE-
CLOSE-WAIT
WAIT
FIN-WAIT-1
FIN-WAIT-1
close / FIN ACK / – FIN / –
ESTABLISHED
ESTABLISHED ESTABLISHED
ESTABLISHED

Client States Server States

Note that the FIN-WAIT-2 state is not used in this case. Note also that there
are changes in the server side that are not shown in the text because this is
somewhat of an implementation issue. In this case, the server sends FIN +
ACK before going to the LAST-ACK state.

P24-21. Bob, the server, sends the response to Alice’s IP address; the destination IP
address is the source IP address in the request message. Since Alice has not
requested this response, the response is dropped and lost. Eve can receive the
response only if she can intercept the message.

P24-23. The probability of this mistake is very low because the initial sequence num-
ber (ISN) has a high probability of being unique. Assume Alice and Bob were
using ISNs x and y, respectively in the previous connection, but z and t in this
connection. The old ACK segment (third segment) has the acknowledgment
number (y + 1); the new ACK segment should have the acknowledgment (t +
1). Bob’s server immediately recognizes the problem and sends an RST seg-
ment to abort the connection. Alice then needs to start a new connection.

P24-25. The receiving TCP allocates a fixed-size buffer (the same size as the buffer
allocated by the sending site). The application program at the receiver site
pulls data from the buffer, which means there is no flow control from the
receiving TCP toward the application program. Data received from the send-
ing TCP are stored in the buffer until they are consumed by the application
program. The part of the buffer that is still empty is advertised as the value of
rwnd to the sending TCP (flow control). The following figure shows a simple
example how the buffer status will change. We have shown both linear and
8

circular representation of the buffer. The latter better shows the position of the
data read by the application.

Note:
Red arrow shows
where the next byte
is read from the buffer

(rwnd = buffer size)


0% full

(rwnd = 75% buffer size)


25% full

(rwnd = 50% buffer size)


50% full

Flow control feedback


(rwnd = 75% buffer size)
75% empty

(rwnd = buffer size)


100% empty

(rwnd = 50% buffer size)


50% empty

(rwnd = 0)
100% full

P24-27. The following figure shows the time line for each segment. Note that the situ-
ation is improved from the previous situation. Both of Nagle’s rules are
applied. Some segments are sent with the maximum segment size; others in
9

response to an ACK. The improvement is because the receiver delays


acknowledgments.

Client Server

Process TCP TCP Process

t: 10 ms Bytes 01-10 Bytes 0


1 1-10
Bytes 11-20 Bytes 01-10
t: 20 ms t: 20 ms
t: 30 ms Bytes 21-30

t: 40 ms Bytes 31-40 Bytes 1


2 1-40 (M
SS)
Bytes 41-50 Bytes 11-40
t: 50 ms t: 50 ms
ACK
t: 60 ms Bytes 51-60
3 Bytes 4
1-60
Bytes 61-70 Bytes 41-60
t: 70 ms t: 70 ms
t: 80 ms Bytes 71-80

t: 90 ms Bytes 81-90 Bytes 6


4 1-90 (M
SS)
t: 100 ms Bytes 91-100 Bytes 61-90
t: 100 ms
ACK
5 Bytes 9
1-100
Bytes 91-100
t: 110 ms

60 ms

ACK

Time Time Time Time

P24-29. We explain each case separately:

a. When a received segment has a sequence number greater than Rn, it means
that the bytes are received out of order. TCP stores the bytes in the receive
window, but it sends an ACK with the acknowledgment number equal to
Rn to help fast retransmission of the missing bytes. This is a duplicate ACK
because the receiver has already sent an ACK with the acknowledgment
number equal to Rn. The issuing of duplicate ACKs is only a clue to the
sender that some packets have arrived out of order. If three duplicate ACKs
arrive, the sender deploys the fast retransmission and resends the packet
with the sequence number defined by the acknowledgment.
b. When a duplicate segment arrives, the receiver TCP drops the packet and
sends an ACK that defines the segment expected. This is also a duplicate
ACK that gives a clue to the sender that its timer may have timed out pre-
maturely. One might ask how the receiver could know whether the dupli-
10

cate ACK is for an out-of-order segment or a duplicate segment. To trigger


a fast retransmission, the sender needs to receive three duplicate ACKs
(four ACKs with the same sequence number); a duplicate ACK per se does
not trigger a fast retransmission.

P24-31. The data from the client process, 5400 bytes, can be divided into six chunks
(five chunks of 980 bytes and one chunk of 500 bytes). After adding a header
of 20 bytes, we have six segments (five segments of 1000 bytes and one seg-
ment of 520 bytes). The segments and the ACKs are created according to the
rule we mentioned in the text. The size of the congestion window is increased
by one MSS for each ACK received. If we follow the growth of the cwnd, we
can see the pattern is exponential, but the base is decreased from 2 to 1.5 (20 =
1, 21 = 2, 1.752 ≈ 3, 1.603 ≈ 4, and 1.54 ≈ 5).

Segment
ACK
Client Server

cwnd = 1000 bytes

500
ms

cwnd = 2000 bytes

cwnd = 3000 bytes

cwnd = 4000 bytes


500
ms

cwnd = 5000 bytes

Time Time

P24-33. The following shows the events and the values. The units of windows and
ssthresh are MSS. We use abbreviations for states such as slow start (SS), con-
gestion avoidance (CA), and fast recovery (FR). The leftmost state shows the
current state, the rightmost one shows the new state.

State Event ssthresh cwnd State


SS ACK arrived 8 5+1=6 SS
SS ACK arrived 8 6+1=7 SS
SS ACK arrived 8 7+1=8 CA
11

CA 3 dup-ACKs 4 4+3=7 FR
FR dup-ACK 4 7 + 1/7 ≈ 7.14 FR
FR dup-ACK 4 7.14 + 1/(7.14) = 7.38 FR
FR ACK arrived 4 4 CA
CA ACK arrived 4 4 + 1/4 = 4.25 CA
CA Time-out 2.12 1 SS

P24-35. According to Karn’s algorithm, we need to ignore the RTT for segment 1 in
our calculation because it was timed-out and resent. Using only segment 2, the
calculation is shown below:

RTTM = 23 − 6 = 17 ms
RTTS = (1 − 0.2) RTTS + 0.2 × RTTM = 14.6 ms

The following shows the calculation:

RTTD = (1 − β) × RTTD + β × |RTTS − RTTM|


RTTD = (1 − 0.25) × 7 + 0.25 × |17 − 20| = 6 ms

P24-37. It sends an INIT_ACK chunk.

P24-39.

a. 0432 in hex is 1074 in decimal. The source port is 1074.


b. 0017 in hex is 23 in decimal. The destination port is 23.
c. The verification tag is 1.
d. The checksum is 0.

P24-41. See the following figure. Chunks 18 and 19 are sent but not acknowledged
(200 bytes of data). 18 DATA chunks (1800 bytes) can be sent, but only 4
chunks are in the queue. Chunk 20 is the next chunk to be sent.

outstanding
From process chunks

23 22 21 20 19 18 To send
Sending Queue 20 curTSN
2000 rwnd
200 inTransit

P24-43. See the following figure. We have filled the fields with available information.
Each packet has the general header and the appropriate control chunk. Note
12

that only the SHUTDOWN chunk has the cumTSN ACK, which acknowl-
edges the receipt of the last packet.

Client Server

2000
1
7 0 8
570
SHUTDOWN
806
2
8 0 4
SHUTDOWN ACK

2000
3
14 0 T 4
SHUTDOWN COMPLETE
Time Time
CHAPTER 25

PRACTICE SET

Questions
Q25-1. No changes are needed. The new protocol needs to use the services provided
by one of the transport-layer protocols.

Q25-3. A server should always be on because a client may need to access it at any
time. A client is normally the initializer of the connection; it can be run when
it is needed.

Q25-5. A personal computer, such as a desktop or a laptop, is normally used as a cli-


ent. If a business needs to use a computer as a server, it should be more power-
ful to allow several connections from clients at the same time.

Q25-7. A keyboard is a source. A monitor cannot be a source; it is only a sink. A


socket can be both a source and a sink.

Q25-9. The client should either know the IP address of the server being communi-
cated with or should know the name of the server (URL) and use the DNS to
map the name to the IP address. The client should know the well-known port
number of the corresponding server process.

Q25-11. We can use the second constructor of the InetSocketAddress and use the port
number 51000. An IP address is represented in Java as an instance of the Ine-
tAddress class.

InetSocketAddress sockAd = new InetSocketAddress ("some.com", 51000);

Q25-13. An integer in Java is in the range (−231) and (231 − 1). We need to be sure that
the port number is always between (0 to 216− 1). For this reason, we need to
set the 16 leftmost bits of the integer to 0.

Q25-15. All pieces of information in an InetAddress object are somehow bound


together. A user cannot just insert an IP address or a domain name in an
instance of this class. These two pieces of information are bound together in

1
2

the corresponding DNS record. A user can only create a variable of type Inet-
Address and call one of the appropriate static methods to fill the related val-
ues. Even if we know the IP address of a host (for example 23.12.56.8) we
cannot create an InetAddress object out of this value; we should let all pieces
of information be filled by calling the appropriate static method.

Q25-17. We first need to create a variable of type InetAddress and then call the static
method that accepts the name of the computer and returns an object of type
InetAddress. Note that the given IP address (as a string) in this case is inter-
preted as another name for the computer. So we need to call the static method
that takes the name of the computer and returns an instance of the InetAddress
class. This means that the method still sends a request to a DNS server and if
the corresponding IP address is not assigned to any host, the UnknownHost-
Exception will be thrown.

InetAddress addr = InetAddress.getByName ("23.14.76.44");

Q25-19. We first need to create an array in which each element is an object of type Ine-
tAddress. We then call the corresponding static method to fill the array.

InetAddress [] addrAll = InetAddress.getAllByName ("14.26.89.101");

Q25-21. There is no static method to return all of the InetAddress objects associated
with the local computer. We can first find one of the InetAddress instances,
get the canonical name of the computer, and then use the canonical name to
get all InetAddress objects.

InetAddress addrLocal = InetAddress.getLocalHost ();


String name = addrLocal.getCanonicalHostName ();
InetAddress [] addrAll = InetAddress.getAllByName (name);

Q25-23. The answer is negative. All of the three constructors of the InetSocketAddress
are based on the fact that the IP address should belong to a host. In the first
constructor, the IP address comes from an InetAddress object, which can only
exist if the IP address is assigned to a host. In the second constructor, the IP
address is the IP address of the local computer. In the third constructor, the IP
address comes from the DNS record, which is called by the first parameter in
the constructor.

Q25-25. We can use the second constructor of the InetSocketAddress and use the port
number 56000.

InetSocketAddress sockAd = new InetSocketAddress (56000);


3

Q25-27. We can use the appropriate constructor of the InetSocketAddress and use the
port number 23.

InetSocketAddress sockAd = new InetSocketAddress (addr, 23);

Q25-29. We can use the appropriate method of InetSocketAddress class to do so.

int port = sockAd. getPort ();

Q25-31. Both classes are used in TCP communication for creating sockets. The Server-
Socket class is used at the server site as the listening socket to wait for a client
to make a connection. The Socket class is used at both client and server sites
to create sockets for data transfer.

Q25-33. We need to use the second constructor in Table 25.11, which includes the IP
address and the port number of the remote site.

Q25-35. The DatagramPacket object is designed to handle an array of bytes. The


request (in any format) first needs to be converted to a sequence of bytes and
stored in the sendBuff to be accepted by the DatagramPacket object. Conver-
sion needs to be done in the makeRequest method.

Q25-37. The client program executes the client.getResponse() statement (Line 76).
This statement is blocking because it calls the receive (...) method of the Data-
gramSocket, which is blocking. The program is blocked until the response
arrives.

Q25-39. The input stream in the TCP client program needs to be attached to the Socket
object. None of the input stream classes in Java have a method to do so. This
input stream needs to be created in conjunction with the Socket object.

Problems
P25-1. The recvfrom() function is a blocking procedure. When it is called, it sleeps
until a datagram arrives from the remote site. Once the datagram arrives, it
wakes up and calls the request handler.

P25-3. Instead of using just one buffer, we need to have two buffers: recvBuffer and
sendBuffer. In line 32, we use the recvBuffer; in line 35, we use the sendBuf-
fer. We also need a line of codes between lines 33 and 34 to process the
request and create the response. The codes need to read the request in the
recvBuffer and write the response to the sendBuffer.
4

P25-5. The following shows an approach. Since the standard Java has no unsigned
integer, we have used a long data type, in which the leftmost 32 bits are set to
0s and the rightmost 32 bits represent the numeric value of the address.

1 public static String numAddrToStrAddr (long numAddr)


2 {
3 StringBuffer strBuf = new StringBuffer (15);
4 long rem;
5 for (int i = 0; i < 4; i++)
6 {
7 rem = numAddr% 256L;
8 strBuf = strBuf.insert (0, rem);
9 if (i < 3) strBuf = strBuf.insert (0, '.');
10 numAddr = numAddr / 256L;
11 } // End of for-loop
12 return strBuf.toString();
13 } // End of method
Given: 370,036,269
Returned: "22.14.78.45"

P25-7. The following shows an approach.

1 public static String extractAddr (String cidrAddr)


2 {
3 StringTokenizer tokenizer = new StringTokenizer (cidrAddr, "/", false);
4 String addr = tokenizer.nextToken ();
5 return addr;
6 } // End of method
Given: "22.14.78.45/14"
Returned: 22.14.78.45

P25-9. The following shows an approach. Since the standard Java has no unsigned
integer, we have used a long data type, in which the leftmost 32 bits are set to
0s and the rightmost 32 bits represent the numeric value of the address.

1 public static long prefixToNumMask (int prefix)


2 {
3 long numMask = (long) Math.pow (2, 32 − prefix) − 1L;
4 numMask = (~ numMask) & 0x00000000FFFFFFFFL;
5 return numMask;
5

6 } // End of method
Given: 23
Returned: 4,294,966,784

P25-11. The following shows an approach. Note that we are calling some methods we
have used in the solutions to previous problems.

1 public static String findFirstAddr (String cidrAddr)

2 {

3 int prefix = extractPrefix (cidrAddr);

4 String addr = extractAddr (cidrAddr);

5 long numAddr = strAddrToNumAddr (addr);

6 long numMask = prefixToNumMask (prefix);

7 long numFirstAddr = numAddr & numMask;

8 String firstAddr = numAddrToStrAddr (numFirstAddr);

9 firstAddr = addPrefix (firstAddr, prefix);

10 return firstAddr;

11 } // End of method
Given: "27.92.13.56/17"
Returned: 27.92.0.0/17

P25-13. The following shows an approach. Note that we are calling some methods we
have used in the solutions to previous problems.

1 public static long findBlockSize (String cidrAddr)


2 {
3 int prefix = extractPrefix (cidrAddr);
4 long size = (long) Math.pow (2, 32 − prefix);
5 return size;
6 } // End of method
Given: "42.14.56.67/14"
Returned: 262144

P25-15. We need to use the concurrent UDP server program (posted on the book web
site under the extra materials for Chapter 25), but replace the three methods
makeRequest (), useResponse(), and process() as shown in Example 25.4 in
the text.
6

P25-17. We need to use the concurrent TCP server program (posted on the book web
site under the extra materials for Chapter 25), but replace the three methods
makeRequest (), useResponse(), and process() as shown in Example 25.4 in
the text.
CHAPTER 26

PRACTICE SET

Questions
Q26-1. Probably Alice turned off her desktop, which stopped the FTP server, when
she left the office. A server process should be running all the time, waiting for
clients to access it.

Q26-3. In an HTTP request message, a blank line signals the end of the headers and
the beginning of the body of the message, if any.

Q26-5. One example can be the use of a remote control when we are watching TV.
The remote control establishes a control connection with the TV set, which is
separate from one-way multimedia connection.

Q26-7. FTP definitely cannot use the services of UDP for control connection because
the client and the server need to be connected during the whole session. Since
UDP is not a connection-oriented protocol, it cannot do this task. FTP does
not use the services of UDP during data transmission for another reason. A
file to be transferred may be too large to fit in a single user datagram (UDP
packet). In addition, UDP is not a reliable transport-layer protocol; for file
transfer, reliability is an important issue. TCP is more appropriate for this pur-
pose.

Q26-9. If the control connection is severed during a session, no more control informa-
tion can be exchanged between the client control process and the server con-
trol process. Since the control connection and the data connection are two
separate TCP connections, the severance of the control connection has no
effect on the current data connection. However, when the current data connec-
tion is terminated, no new data connection can be made until the control con-
nection is again established.

Q26-11. The answer is no. Data-transfer activity is controlled by the client. If a file
needs to be transferred from the client site to the server site, the client needs to
store it at the server site.
Q26-13. FTP allows the client to define the file format it can receive or send; the server
needs to use the format acceptable to the client when sending a file and to
accept the format used by the client when receiving a file.

1
2

Q26-15. The file (or list of directories or files, which is consider as a file) is transmitted
using stream mode (default), block mode, or compressed mode. The mode is
determined by the client using the MODE command. In the stream mode, no
header is added to the file bytes; in the other two modes, a header is added to
the beginning of the file to show information about blocking or compressing.

Q26-17. The answer is no. We cannot have a data-transfer connection without a control
connection. The data-transfer connection is established with one or more com-
mands issued from a client; there should be a control connection to allow the
client to issue these commands.

Q26-19. It depends on how the file is stored on the server. If the file is stored as a web
page, embedded in an HTML document, we need to use HTTP to download
the file. On the other hand, if the file is stored on the server without having
been embedded in an HTML document, then we need to download it using
FTP.

Q26-21. The MAIL FROM in the envelope contains the source e-mail address while
the FROM in the header contains the name of the sender.

Q26-23. The client changes the ASCII character to NVT characters. The server
changes NVT characters to EBCDIC.

Q26-25. When a host logs into a remote computer, it can use all services available on
that host. Since an FTP or an HTTP server provides services, the user can use
these services. As a matter of fact, the TELNET interface allows the user to
define the port number of the server she wants to use.

Problems
P26-1. The following shows a possible request and response:
a. A possible request
GET /usr/users/doc HTTP /1.1
Date: Fri, 26-Nov-04 16:46:23 GMT
MIME-version: 1.0
Accept: image/gif
Accept: image/jpeg
Last modified: Mon, 22-Nov-04
b. A possible response
HTTP/1.1 200 OK
Date: Fri, 26-Nov-04 16:46:26 GMT
Server: Challenger
MIME-version: 1.0
Content-length: 4623
(Body of document)
3

P26-3. The following shows a simple situation. A portal is a special site that holds
the often-visited URLs for each client. The cookie stored in the browser under
the name of the portal holds the list of the sites the user normally needs to
check periodically. When the user clicks on the portal web page, a request is
sent with the cookie to the portal site with the list of desired web pages. The
portal then fetches the current pages from the corresponding site, compiles a
page, and sends it to the browser.

Portal Client
cookie Portal Site 1 Site 2
Site 1
Site 2
Request
1 + cookie
2 Request

3
P1
4 Request

5
6
P2
P1 P2

P26-5. The following shows a simple example. In part a, the request can be
responded to by the proxy server. In part b, the proxy needs to send the request
to the true server. When the response is received, the proxy server saves it in
the cache for future use, and then sends it to the client.

Client
Proxy

Server

Internet

Request
Answer 1
to part a Response
2

Request
1
Request
2
Answer Add resposne Response
to part b to the cache
3

Response
4

Time Time Time


4

P26-7. HTTP provides some presentation features, using the request and response
headers. For example, HTTP messages can define the format and the language
of the messages exchanged, which is a kind of presentation.

P26-9.
MIME-version: 1.1

Content-Type: Text/Plain
Content-Transfer-Encoding: 7bit

P26-11. Since there are several programs to do the job, we post on the book web site.
See extra materials for Chapter 26.

P26-13. The result is "Vw/w" in ASCII as shown below:

Original: 01010111 00001111 11110000


Grouped by six: 010101 110000 111111 110000
Base64: 21 48 63 48
ASCII: V w / w

P26-15. The following shows the four states and the transitions from one state to
another.

Start
All messages marked
Closed
for delete become effective TCP connection
and TCP connection is is established.
terminated.

Update Authorization

Client issues The client is


QUIT command. authenticated
for the server.
Transaction
The client and server
exchange commands
and responses. Mails
are retrieved.

P26-17. The following gives the meaning and usage of each command:

a. The UIDL (unique ID listing) is used by the client to provide a unique


identifier for the message (if used with an argument) or for all messages (if
no argument is used).
5

b. The TOP command, always with two arguments, is used by the client to
ask the server to return the top lines of a particular message. In this case, it
means to return the top 15 lines of message 1.
c. The USER command is used by the client to define its user identification.
d. The PASS command is used by the client to define its password.

P26-19. The following shows an example. We have shown only part of the transaction
(when the client starts retrieving the message):

Client: RETR 1
Server: +OK 230 octets
Server: … // Message contents
Server: . // Dot means end of mail
Client: DELE 1
Server: +OK message 1 deleted
Client: RETR 2
Server: OK 400 octets
Server: … // Message contents
Server: . // Dot means end of mail
Client: DELE 2
Server: +OK message 2 deleted

P26-21. SMTP does not create a session between the client and sender in which the cli-
ent can send some e-mails in a single session. The e-mails need to be sent one
by one. However, POP3 allows the user to retrieve all e-mails received in the
mailbox in one session.

P26-23. The following shows the commands and responses. The file mode in this case
needs to be C (compressed).

Server: 220 (Service ready)


Client: USER Jane

Server: 331 (User name OK. Password?)


Client: PASS xxxx

Server: 220 (User login OK)


Client: PORT 61017

Server: 150 (Data connection will open shortly)


Client: STRU F

Server: 200 (OK)


Client: TYPE E

Server: 200 (OK)


6

Client: MODE C

Server: 200 (OK)


Client: RETR /usr/users/report/huge

Server: 125 (Data connection OK)


Transferring the file from the server to the client
Server: 226 (Closing data connection)
Client: Quit

Server: 221 (Server closing)

P26-25. The following shows the set of commands and responses. Note that there is no
data transfer connection in this; we have only a control connection. We need
to give the name of the file to be renamed (/usr/users/report/file1) and then the
new name (/usr/top/letters/file1).

Server: 220 (Service ready)


Client: USER Maria
Server: 331 (User name OK. Password?)
Client: PASS xxxx
Server: 220 (User login OK)
Client: RNFR /usr/users/report/file1
Server: 200 (Command OK)
Client: RNTO /usr/top/letters/file1
Server: 200 (Command OK)
Client: Quit
Server: 221 (Server closing)
CHAPTER 27

PRACTICE SET

Questions
Q27-1. Fault and performance are areas of management defined by OSI; personnel is
not.

Q27-3. This is related to hardware reconfiguration, which is part of reconfiguration,


which is in turn part of configuration management.

Q27-5. Reactive fault management is responsible for handling faults in a timely man-
ner. Proactive fault management is responsible for preventing some faults
from occurring.

Q27-7. Internal traffic measures the number of packets circulated inside the network;
external traffic measures the number of packets sent to or received from out-
side.

Q27-9. A router or a switch cannot be used as a manager station; only a host can be a
manager station.

Q27-11. The name is encoded as 1.3.6.

Q27-13.

a. Simple
b. Simple
c. Simple
d. Sequence of
e. Sequence
f. Sequence of

Q27-15. SMI only sets the rules for naming objects, distinguishes between simple data
types and shows how to combine them to make structured data types, and
specifies how to encode objects and the values to be stored in those objects.

1
2

MIB, on the other hand, defines the objects to be managed in SNMP using the
rules set by SMI.

Q27-17. The identifiers of the variables are x.1, x.2, and x.3.

Q27-19. SNMP can only reference an entity which is a leaf in the MIB tree. Non-leaf
entities in the leaf are not variables to be accessed.

Q27-21. We can say that tables in the MIB are column-oriented. This means that each
column in a table is represented by a leaf in the MIB tree. In this case, we have
three leaves related to the table. The rows in a table are not represented as
leaves in the MIB tree because the number of rows are not fixed from one
object to another. Consider the case of a forwarding (routing) table. A router
may have a forwarding table with three rows; another table may have a for-
warding table with eight rows.

Q27-23.

a. A GetRequest PDU is sent from a client (manager) to a server (agent).


b. A Response PDU is sent from a server (agent) to a client (manager).
c. A Trap PDU is sent from a server (agent) to a client (manager).

Problems
P27-1. The identifiers are (x.1) and (x.2). The variable identifier of an object does not
have any relation to the type of the variable. Each simple variable of an object
is a leaf on the MIB tree, as shown below:

x
Object x MIB tree
x.1 x.2
Variables
x.1 x.2

P27-3. Since MIB considers each column of a tree as a variable, we have four leaves
on the tree. The identifiers for the two variables are (x.1) and (x.2). The identi-
fier for the table is (x.3), which is not a leaf. The identifier for the table entry is
(x.3.1). Each column has an identifier on the leaf. The identifier for the first
column is (x.3.1.1); the identifier for the second column is (x.3.1.2).

P27-5. A simple variable has only one instance, which is not on the MIB tree. The
instance can be referred to by adding a zero to the identifier of the variable. In
3

this case, the identifiers of the variables are (x.1) and (x.2). The instances can
be referred to as (x.1.0) and (x.2.0).

P27-7. The identifier of the table is (1.3.6.1.2.4.21). The identifier of the table entry is
(1.3.6.1.2.4.21.1). The identifier of the second column is (1.3.6.1.2.4.21.1.2).
Each instance must add the corresponding index, which is the destination IP
addresses:

First instance: column 2, row 1: 1.3.6.1.2.4.21.1.2.201.14.67.0


Second instance: column 2, row 2: 1.3.6.1.2.4.21.1.2.123.16.0.0
Third instance: column 2, row 3: 1.3.6.1.2.4.21.1.2.11.0.0.0
Fourth instance: column 2, row 4: 1.3.6.1.2.4.21.1.2.0.0.0.0

P27-9. Using TLV (tag, length, and value), we have:

Tag Length Value


04 0C 48 65 6C 6C 6F 20 57 6F 72 6C 64 2E

The length of the string (including space and period) is 12 or 0C in hexadeci-


mal. The value of the string is based on ASCII (see Appendix A). The encod-
ing in compact form is 040C48656C6C6F20576F726C642E.

P27-11. Using TLV (tag, length, and value), we have:

Tag Length Value


06 08 01 03 06 01 02 01 07 01

Each digit in the identifier is translated into two hexadecimal digits. The
encoding in compact form is 06080103060102010701.

P27-13. First we need to encode the inner sequence and then the outer one, as shown
below:

40 04 1864060E 04 03 554450
30 19 02 04 00000083 30 11
IPAddress OCTETSTRING
Integer
Sequence
Sequence

The total length is (13 + 6 = 19) bytes. The whole data type in compact format
is

3019020400000083301140041846060E0403553350
4

P27-15. Since the code starts with the tag 30, it is a sequence. We need to split the code
carefully to find each component.

T L T L V T L V
30 0C 02 04 00 00 09 98 40 04 0A 05 03 0E

The first byte is the tag for a sequence and the next byte is the length of the
sequence (12 bytes). The next byte defines a data type (an integer). The next
byte is the length of the integer (4 bytes) and the next four bytes define the
value (2456). The last tag defines an IP address with the value 10.5.3.14. In
summary, the code defines a sequence of an integer and an IP address. The
following shows the whole data type using ASN.1:

SEQUENCE
{
INTEGER 2456
IP Address 10.5.3.14
}

P27-17. A VarBind is a sequence of two data items: the corresponding object identifier
and the value of the variable.

a. In the GetRequest message the sequence is the instance of the object identi-
fier (the last 00 defines the instance). The last two bytes defines the identi-
fier of the null object (05) and the null value (00).

T L T L V T L
30 0D 06 0B 010306010201070400 05 00

b. In the Response message the sequence is the instance of the object identi-
fier (the last 00 defines the instance). The last six bytes defines a counter of
length 4 with the value 15.

T L T L V T L V
30 11 06 0F 010306010201070400 41 04 0000000F
5

P27-19. A GetRequest PDU is a structure of five elements, as shown in Figure 27.18.


It can be defined as shown below. Note that VarBindList is itself a structure
that needs to be defined.

GetRequest PDU ::= SEQUENCE


{
PDUType Tag
RequestID Integer32
ErrorStatus INTEGER (0..18)
ErrorIndex INTEGER
VariableBinding VarBindList
}

P27-21. A VarBindList is a list of VarBinds. Note that VarBind is itself a structure that
needs to be defined.

VarBindList ::= SEQUENCE OF


{
VarBindList VarBind

}
CHAPTER 28

PRACTICE SET

Questions
Q28-1. In dictionary coding, the number of iterations in the loop is one less than the
number of characters in the message. In this case, the number of iterations is
59.

Q28-3. In a Huffman tree, the number of leaves is the same as the number of symbols.
Therefore, we have 20 leaves in the tree.

Q28-5. The encoding table can be the following:

A → 00 B → 01 C → 10 D → 11

Huffman coding cannot help here because we could have encoded each char-
acter as two bits. Huffman coding will help if the occurrence probabilities of
the characters in the messages are different and we can send fewer bits for
characters with high probability and more bits for characters with low proba-
bility.

Q28-7. ADM is a variation of DM in which the value of Δ may change from one step
to another.

Q28-9. The answer is given for each case for both PCM and DM.

a. PCM: 4 (because 24 = 16) and DM: 1


b. PCM: 5 (because 25 = 32) and DM: 1
c. PCM: 6 (because 26 = 64) and DM: 1

Q28-11. In DM, only the immediate previous yn value is used in the calculation of en.
In DPCM, weighted averages of several previous yn values are used in the cal-
culation of en.

Q28-13. The answer is no. The value of the T matrix entries, for each value of N, is
fixed. The receiver either has the matrix or can generate it.
1
2

Q28-15. The value of Q(m, n) becomes larger and larger when we move toward the
higher frequencies in the matrix, from M(0, 0) to M(N−1, N−1) diagonally.
This is done to reduce the effect of higher frequencies. Human eyes cannot
recognize the higher frequencies when their amplitude (strength) is outside of
an upper and a lower threshold. The values in the Q(m, n) matrix are selected
based on this property. Dividing the amplitude of higher frequencies by a
larger number makes these amplitudes smaller and smaller, finally moving
them toward zero values and elimination (better compression).

Q28-17. The whole idea is to change the real numbers (values with fractions) to integer
values to reduce the number of transmitted bits. The real value 14.125 or
(1110.001)2 needs seven bits to send; the integer value 14 or (1110)2 needs
only four bits to send. The number of bits to send tremendously increases if
we want to use a high level of precision.

Q28-19. The answer is no. Multimedia data encoded in JPEG cannot be recovered
using GIF and vice versa. If two entities want to communicate, they must use
the same encoding and decoding scheme.

Q28-21. In the second approach, the whole multimedia file is downloaded using HTTP
as the application-layer protocol. In the third approach, HTTP is only respon-
sible for downloading the metafile; the actual multimedia file is normally
downloaded using a specific application program that may use the service of
UDP/RTP.

Q28-23. In live audio/video, the multimedia data is being sent on the Internet no matter
whether we use it or not. In real-time interactive audio/video, two parties start
exchanging multimedia when they both agree to do so.

Q28-25. The answer is yes. The protocol defines a server as a process running at the
application level. The two servers can be on the same machine or different
machines.

Q28-27. The answer is negative. The sequence numbers or timestamps are needed to
glue the chunks together in time. When all chunks can be carried in one
packet, they arrive all together and in the order they are inserted into the
packet. There is no need for sequence numbers or timestamps.

Q28-29. The sequence numbers in RTP and TCP play almost the same role. They
check to see if a packet is missing. However, there are some differences in the
nature and applications of the sequence numbers in these two protocols.

a. In TCP, sequence numbers are byte-oriented. The sequence number defines


the number of the first byte in each segment. This means that the sequence
number can jump from one segment to another if the segment carries more
than one byte. In RTP, sequence numbers are packet oriented: the sequence
3

number defines the packet. Two consecutive packets sent by the source
have consecutive sequence numbers.
b. The applications of the sequence numbers in these two protocols are some-
what different. The sequence numbers in TCP are related to acknowledg-
ment numbers, and, if the sequence numbers attached to bytes in a packet
are not acknowledged, the bytes are resent. In RTP, the sequence numbers
are still used to indicate whether an RTP packet is lost. However, there is
no retransmission. The receiver needs to know this fact to somehow find a
remedy for it.

Q28-31. If there is only one source sending the multimedia application and audio and
video are mixed by the application program, we have only one synchroniza-
tion source (the synchronization source and contributor source is the same).
This means that the value of the contributor count is 0 and there is no CSRC
field. Without the extension header and CSRC fields, the size of the RTP
packet is only 12 bytes.

Q28-33. The encoding applied on a chunk of data can be different from the encoding
applied on another chunk of data, although this practice is not very common.

Q28-35. Each packet needs to carry an SSRC and a CSRC identifier. The SSRC identi-
fier is the same for audio and video packets, but the CSRC identifier is differ-
ent for each type of packet. In other words, we have two CSRCs, but only one
SSRC during the session.

Q28-37. RTCP sends messages to control the flow and quality of data and allows the
receiver to send feedback to the source. TCP already has this mechanism, so it
doesn’t need this protocol.

Q28-39. The caller and the callee each play the roles of the client and the server. In
other words, SIP can be considered as a peer-to-peer application program
instead of a client-server program. Both parties use the registered port number
5060.

Q28-41. This needs to be defined during the call setup, when they exchange SIP mes-
sages to establish the call. Each party can define the port number at which
desires to receive the RTP packets.

Q28-43. The wired or wireless environment defines the link at which communication
occurs (data-link layer). The RTP/RTCP and SIP are application-layer proto-
cols. Like any application-layer message, they are eventually carried in a data-
link layer (wired or wireless).

Q28-45. Bob can register the two addresses with the SIP proxy server. When a tele-
phone call arrives, the proxy server can fork the call to both destinations.
4

Q28-47. Yes, H.323 can be used for both audio and video.

Problems
P28-1. We replace each run of the same character with a count and the symbol as
shown below.

3A6C1B4C5D4A3B

The compression rate is 26/14 or almost 1.86.

P28-3. Let us show how the dictionary for each case is made using the knowledge
about the previous case.

a. Dictionary is 0 → A; the code is 0.


b. Dictionary is 0 → A and 1 → AA; the code is 00.
c. Dictionary is 0 → A and 1 → AA; the code is 01.
d. Dictionary is 0 → A, 1 → AA, and 2 → AAA; the code is 010.
e. Dictionary is 0 → A, 1 → AA, and 2 → AAA; the code is 011.
f. Dictionary is 0 → A, 1 → AA, and 2 → AAA; the code is 012.

P28-5. We follow the procedure in Table 28.2. The loop is shown inside the frame
with a thick border. We need to initialize the dictionary before reading the
code. The message is "AACCCBCCDDAB".

PreC S C S + first char Dictionary Message


0 A
1 B
2 C
3 D
0 A
if 0 A 0 AA 4 AA A
if 0 A 2 AC 5 AC C
else 2 C 6 CC 6 CC CC
if 6 CC 1 CCB 7 CCB B
if 1 B 6 BC 8 BC CC
if 6 CC 3 CCD 9 CCD D
if 3 D 3 DD 10 DD D
if 3 D 0 DA 11 DA A
if 0 A 1 AB 12 AB B
5

P28-7. We need to read the code, bit by bit, until we get a sequence of bits that can be
decoded using the table:

0 0 1 1 0 1 1 0 0 1 1 1 1 0 1 1 1 1 1 1 0 1 0
A A − − C − − C A − − D − B − − D − − D A − B

The decoded message is "AACCADBDDAB".

P28-9. The code 100110011 is interpreted as (0.100110011)2 or (0.599609375) in


decimal. We start with the half-open interval [0, 1) to see where this number
fits. The following shows how we narrow the intervals to find the location of
the received code. The result is "BBC*"; the actual message is "BBC".

0.0 0.4 0.7 0.9 1.0


A B C *

0.4 0.52 0.61 0.67 0.7


A B C *

0.52 0.556 0.583 0.601 0.61


A B C *

0.583 0.5902 0.5956 0.5992 0.601


A B C *

P28-11. We first calculate the value of qn from the code. If the code is bit 1, the value
of qn is 1; otherwise, it is −1. The value of the yn can then be calculated as yn =
yn −1 + qn × Δ. Note that the value of y0 is not shown in the table, but is given
in the problem as y0 = 8.

n 1 2 3 4 5 6 7 8 9 10 11
Cn 1 0 0 1 0 1 1 0 0 1 1
qn 1 −1 −1 1 −1 1 1 −1 −1 1 1
yn 14 8 2 8 2 8 14 8 2 8 14

P28-13. We first calculate the value of qn from the code. If the code is bit 1, the value
of qn is 1; otherwise, it is −1. The value of Mn can then be calculated depend-
ing on the change in qn. We can then calculate the value of Δn as defined in the
problem. The value of yn can then be calculated using yn = yn −1 + qn × Δn.
Note that the value of y0 is not shown in the table, but is given in the problem
as y0 = 20.

n 1 2 3 4 5 6 7 8 9 10 11
Cn 1 1 1 0 0 1 1 0 0 1 1
qn 1 1 1 −1 −1 1 1 −1 −1 1 1
6

Mn 1 1.5 2.25 1.13 1.70 0.85 1.28 0.64 0.96 0.48 0.72
Δn 4 6 13.5 15.3 26 22.1 28.3 18.1 17.4 8.4 6
yn 24 30 43.5 28.2 2.2 24.3 52.6 34.5 17.1 25.5 31.5

P28-15. The answer is yes. We have T(m, n) = C(m, n) cos(x). The value of cos(x) is
always between −1 and 1. We only need to prove that C(m, n) ≤ 1, which can
be done using two cases:

a. If m = 0 → C(m, n) = (1/N)1/2 ≤ 1 because N ≥ 1.


b. If m > 0 → C(m, n) = (2/N)1/2 ≤ 1 because N ≥ 2.

P28-17. The following shows the four matrices. The first one (N = 1) is actually a
number (scalar value). Note that we have rounded the values to two decimal
digits.

0.50 0.50 0.50 0.50


0.71 0.71 0.65 0.27 -0.27 -0.65
1.00
0.71 -0.71 0.50 -0.50 -0.50 0.50
0.27 -0.65 0.65 -0.27
N=1 N=2 N=4

0.35 0.35 0.35 0.35 0.35 0.35 0.35 0.35


0.49 0.42 0.28 0.10 -0.10 -0.28 -0.42 -0.49
0.46 0.19 -0.19 -0.46 -0.46 -0.19 0.19 0.46
0.42 -0.10 -0.49 -0.28 0.28 0.49 0.10 -0.42
0.35 -0.35 -0.35 0.35 0.35 -0.35 -0.35 0.35
0.28 -0.49 0.10 0.42 -0.42 -0.10 0.49 -0.28
0.19 -0.46 0.46 -0.19 -0.19 0.46 -0.46 0.19
0.10 -0.28 0.42 -0.49 0.49 -0.42 0.28 -0.10

N=8

P28-19. The palette should have the combination of 2 × 2 × 2 = 8 rows, as shown


below with the bit index.

Red Blue Green


000 00000000 00000000 00000000 R = 0, B = 0, G = 0
001 00000000 00000000 00000100 R = 0, B = 0, G = 4
010 00000000 00000101 00000000 R = 0, B = 5, G = 0
011 00000000 00000101 00000100 R = 0, B = 5, G = 4
100 00000111 00000000 00000000 R = 7, B = 0, G = 0
101 00000111 00000000 00000100 R = 7, B = 0, G = 4
110 00000111 00000101 00000000 R = 7, B = 5, G = 0
111 00000111 00000101 00000100 R = 7, B = 5, G = 4

a. For each color in the palette we can send three bits (the index of the row).
7

b. The bit index for the red color is 100, for the blue color is 010, for the green
color is 001, for the black color is 000, for the white color is 111, and for
the magenta is 110.

P28-21. The answer follows:

a. At time 00:00:17
first packet: 10 units arrived, 9 units played, 1 unit in buffer
second packet: 2 units arrived, none played, 3 units in buffer

b. At time 00:00:20
first packet: none left
second packet: 5 units arrived, 2 units played, 3 units in buffer

c. At time 00:00:25
first packet: none left
second packet: 10 units arrived, 7 units played, 3 units in buffer

d. At time 00:00:30
first packet: none left
second packet: none left
third packet: 3 units arrived, 2 units played, 1 unit in buffer

P28-23. The first eight hexadecimal digits are in binary:

1000 0110 0000 0011 0010 0001 0011 0010

a. The first two bits define the version, which means the version is 2.
b. The third bit is the P bit, which means there is no padding.
c. The fourth bit is the X bit, which means there is no extension header.
d. The next four bits define the number of contributors, which is 6 in this
case.
e. The seven bits after the color bit (M) (with the value 3 in decimal) define
the payload type, which means GSM audio.
f. Since we have six contributors, the total size of the packet header is 12
bytes (first part of the header) plus 6 × 4 bytes for CSRCs, for a total of 36
bytes.

P28-25. We can mention several reasons.

a. Live or real-time streaming of multimedia requires that the data be sent in


chunks. A chunk of data is a sequence of bits that have been encoded
together and need to be decoded together; each bit may depend on the rest
of the bits. Although TCP collects eight bits in a byte and transfers each
byte as an atomic unit, the size of the byte is not enough to be a chunk of
8

multimedia data (even a single pixel in an image may need more than eight
bits). A chunk cannot be associated with several bytes because TCP may
split bytes, making a chunk into different segments, which means a chunk
of multimedia data may be in one segment and the other parts in other seg-
ments. What is needed in multimedia is that a chunk of data be carried in a
single packet. Although TCP may use push and urgent flags to artificially
create boundaries for each segment, it is not guaranteed that a TCP imple-
mentation will honor these flags all of the time. On the other hand, a UDP
user datagram is a packet with clear-cut boundaries. A UDP packet, when
combined with RTP/RCTP packets, can carry a single chunk of multimedia
payload, and the size of the UDP datagram is large enough to hold any
chunk of multimedia data as defined so far.
b. TCP is not an appropriate protocol for multicasting and multi-party com-
munication because it is a connection-oriented protocol in which a connec-
tion involves only two parties. UDP, on the other hand, is a connection-less
protocol. Multicasting and multi-party communication can be achieved
using UDP. Using the same multicast address, a UDP sender can send mul-
ticast packets to many receivers; several UDP senders can use the same
multicast addresses to create multi-party communication.
c. TCP delivers data bytes to the application program in order. This means
that if a segment is missing, the out-of-order bytes need to wait. This is not
appropriate for live or real-time interactive multimedia streaming, as dis-
cussed in the text. This problem does not exist in UDP. Each UDP packet is
independent, and the chunk of data carried in a UDP datagram can be
delivered to the application program as it arrives.
d. Since multimedia chunks can use different encoding methods, we need a
field to define the type of payload. A TCP segment lacks this field. A UDP
datagram can allow encapsulation of the RTP packet, which includes this
field.
e. For a live or real-time multimedia streaming, there is a need for synchroni-
zation using timestamps that define the temporal relationship between each
chunk and the other chunks. None of the three protocols, TCP, UDP, or
SCTP, provide timestamping. UDP, however, allows the encapsulation of
the RTP packets, which includes timestamping. Since an SCTP packet can
carry many data chunks in a single packet, timestamping may not be
needed if the stream is short.
f. Congestion control in multimedia communication is a big issue because of
the volume of data exchanged. Although TCP has a congestion control
mechanism, it is not suitable for multimedia communication, because it is
based on segments, not chunks. Congestion control in UDP/RTP is more
convenient for multimedia communication.
CHAPTER 29

PRACTICE SET

Questions
Q29-1.

a. In a centralized network, the directory system uses the client-server para-


digm, but storing and downloading of the files are done using peer-to-peer
paradigm.
b. A decentralized network does not depend on a central directory system.

Q29-3. A decentralized network generates less traffic and is less vulnerable to attacks,
but is more difficult to build.

Q29-5. The number of points is 210 or 1024.

Q29-7. The two strategies are called direct and indirect.

a. In the direct strategy, the object is stored in a peer whose ID is somehow


closest to the object ID.

b. In the indirect strategy, the object is stored in a peer that owns the object,
but a reference is stored in a peer whose ID is somehow closest to the
object ID.

Q29-9.

a. In the direct method, the file is stored in node 20.

b. In the indirect method, the file is stored in node 4, but a reference is given
in node 20.

1
2

Q29-11. For this network, m = log21024 = 10. This means each identifier has 10 bits.
The height of the tree is also 10. The number of leaves is 1024. Each node has
10 subtrees. Each routing table also has 10 rows.

Problem
P29-1. The number of rows in the finger table is log216 = 4. The rows in the table for
node N6 show the successors of target keys (6 + 2m−1) for m = 1 to 4 as shown
below:

m Target key Successor


1 6+1 N8
2 6+2 N8
3 6+4 N12
4 6+8 N3

P29-3. The following shows the ring.

Pre: N11 0
1 N3
2 N3
3 N3 Pre: N13
4 N8 k14 1 N8
Finger 2 N8
N13 N3 3 N8
4 N11
Pre: N8 Pre: Predecessor Finger
1 N13 Finger[1]: Successor
2 N13
3 N3 N11 k5
4 N3
Finger
k9 N8
Legend Pre: N3
: Key 1 N11
: Node 2 N11
3 N13
: Point 4 N3
: Responsible node Finger
3

P29-5. Let us go through the event as we did in Example 2.16 in the text. The follow-
ing shows how N12 with some help from N5 goes through the sequence of
events to find the successor of k7:

k7 N10
N12
6 N10
find_
successor N5
2 Your finger [1]?
k7 N5

N10
find_ N5 is the
predecessor predecessor N5
of k7.
Your finger [1]?
3
Note:
k7 N5 When the loop in
the find_predecessor
4 function terminates,
find_closest_ N12 knows that it
predecessor has found the
predecessor node.

a. Event 1: Since N12 is not the responsible node for k7, it calls its
find_successor function.
b. Event 2: N12 calls the find_predecessor function.
c. Event 3: Since N12 is not the predecessor node of k7, N12 calls the
find_closest_predecessor function. This function checks the finger table of
N12 from bottom to top. It finds that N5 is the closest predecessor because
5 ∈ (12, 7), N5 is between N12 and k7 when going around the ring in the
clockwise direction. This can also be seen if we think of 5 as 37 (in modulo
32 arithmetic) and 7 as 39. Definitely 37 ∈ (12, 39). Note that we need to
add 32 to 5 and 7 because we move from 12 to these two points as we pass
point 0.
d. Event 4: The find_closest_predecessor function returns N5 to the find_ pre-
decessor function as the closest predecessor of k7. N12 finds that N5 is
actually the predecessor of k7 (by remotely calling the N5.finger[1])
because 7 ∈ (5, 10].
e. Event 5: The find_predecessor function returns N5 to the find_successor
function as the predecessor of k7.
f. Event 6: Node N12 finds that the successor node of k7 is N10 by remotely
asking N5 to send its finger [1].
4

P29-7. We have m = log216 = 4. The number of digits in each identifier is n = m/b or


2. The identifiers are in base 22 = 4 as follows: 00 … 03, 10 … 13, 20 … 23,
30 … 33.

P29-9. We have m = log216 = 4 and n = m/b = 4/2 = 2. The routing table has n rows
(here 2) and 2b columns (here 4). The identifiers are 00 to 33 in base 4. The
following shows a possible routing table for node N21. In row 0, there should
be no common digits with the node identifier; the first digit defines the col-
umn number. In row 1, the first digit should be 2 (one common digit with node
N21); the second digit defines the column. Note that some cells can have no
entry.
0 1 2 3
0 00 10 31
1 20 22 23

P29-11. We use the algorithm in the text:

a. Key k24 is not in the range of the leaf set of N02. The routing table should
be used. In this case p = 0 and v = 2, which means we need to look at the
routing table entry [0, 2] = N20. The query is passed to node N20. N20 is
not responsible for k24; the key k24 is not in the range of leaf set of N20;
the routing table is used. In this case, p = 1 and v = 4. Since table entry [1,
4] does not exist, the query is passed to a node sharing a prefix as long as
the current node, but numerically closer to the key, which is N23. The node
N23 is responsible for k24.
b. Key k12 is in the range of the leaf set of N20. The closest node in the leaf
set to k12 is the node N11. The query is passed to N11, which is responsi-
ble for k12.

P29-13. The following takes place:

a. The length of the common prefix between N0 (N0000) and k12 (k1100) is
0. Node N0 sends the query to the node specified in row 0 of its routing
table, node N8.
b. The length of the common prefix between N8 (N1000) and k12 (k1100) is
1. Node N8 sends the query to the node specified in row 1 of its routing
table, node N15.
c. Node 15 is responsible for k12. It responds to the query.
CHAPTER 30

PRACTICE SET

Questions
Q30-1. We cannot define the absolute order, but in normal situation we will rank them
as follows:

1. SNMP 2. HYYP 3. SMTP 4. VoIP

Q30-3. We cannot define the absolute order, but in normal situation we will rank them
as follows:

1. VoIP 2. SNMP 3. HTTP 4. SMTP

Q30-5. Our choice is VoIP. The goal is to make VoIP similar to the telephone conver-
sation we have over the phone using circuit switching.

Q30-7. None of these applications actually fit in this flow class. It is mostly designed
for interactive multimedia applications.

Q30-9. FIFO queueing and priority queueing are techniques used for scheduling.

Q30-11. IntServ uses two flow specifications: Rspec and Tspec.

a. Rspec (Resource specification) defines the resources that the flow needs to
reserve before starting the communication.
b. Tspec (Traffic specification) defines the traffic specification.

Q30-13. IntServ is called destination-base service because the destination host needs to
define the type of service required to start the communication.

Q30-15. IntServ is designed for multicast communication. However, unicast is a spe-


cial case of multicast in which there is only one member in the group.

Q30-17. In IntServ, the resources needs to be reserved before the communication starts.
We need to find the resources needed at each router. We need to send Path and

1
2

collect Resv packets to find the resources the routers need for communication
flow.

Q30-19. The traffic conditioner has four components:

a. Meter
b. Marker
c. Shaper
d. Dropper

Problems
P30-1. We answer each question separately:

a. The following shows the time lines and the contents of the queue:

1 2 3 4 5 6 7

Arrival
t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13
1 2 3 4 5 6 7
Processing
t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13
Departure

1 2 3 4 5 6 7

t0 t1 t2 t3
Q Q Q Q
t4 t5 t6 t7
4 Q 5 Q 6 5 Q 7 6 Q
t8 t9 t10 t11
7 6 Q 7 Q 7 Q 7 Q
t12 t13
Q Q

b. The following shows the calculation of the time spent in the router and the
relative delay for each packet.
Packets: 1 2 3 4 5 6 7
Arrival time t0 t1 t2 t4 t5 t6 t7
Departure time t1 t2 t5 t7 t9 t12 t13
Time spent in the router 1 1 3 3 4 6 6
Relative departure delay − 1 3 2 2 3 1

c. Since the relative departure delay between each packet and the previous
one is not the same, there is jitter even if all packets have the same propa-
gation delay.
3

P30-3. We answer each question separately:

a. The following shows the departure time line.

w=3 w=2 w=1


t0 7 6 5 4 3 2 1 15 14 13 12 11 10 9 8 20 19 18 17 16

t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 t16 t17 t18 t19 t20
Departure

1 2 3 8 9 16 4 5 6 10 11 17 7 12 13 18 14 15 19 20

b. The following shows the contents of queues at t0, t5, t10, t15, and t20.

w=3 w=2 w=1


t5 7 6 5 4 15 14 13 12 11 10 20 19 18 17

t10 7 15 14 13 12 20 19 18 17

t15 15 14 20 19

t20

c. We can calculate the relative delay between packets for the class w = 3 as
shown below. Since departure delays are different, the packets introduce
jitter even if they have the same propagation time.
Packets 1 2 3 4 5 6 7
Departure time t0 t1 t2 t6 t7 t8 t12
Delay with respect to previous packet − 1 1 4 1 1 4

d. We can calculate the relative delay between packets for the class w = 2 as
shown below. Since departure delays are different, the packets introduce
jitter even if they have the same propagation time.
Packets 8 9 10 11 12 13 14 15
Departure time t3 t4 t9 t10 t13 t14 t16 t17
Delay with respect to previous packet − 1 5 1 3 1 2 1

e. We can calculate the relative delay between packets for the class w = 1 as
shown below. Since departure delays are different, the packets introduce
jitter even if they have the same propagation time.
Packets 16 17 18 19 20
Departure time t5 t11 t15 t18 t19
Delay with respect to previous packet − 6 4 3 1
4

P30-5.

a. The input during the first minute is (100 gallons/minute) × (12/60 minute)
or 20 gallons.
b. The output during the first minutes is (5 gallons/minute) × (1 minute) or 5
gallons.
c. This means that after the first minute, 15 gallons of liquid is left in the
bucket. The problem does not mention the input rate after the first minute.
If there is no input flow, the bucket would be empty after four minutes.

P30-7. We set the value of n = 1000 bits and the time tick to one second. In each tick
of time, only 2 packets will be transmitted, as shown below.

a. The value of the counter is set to 1000; the size of the first packet (400 bits)
is less than the value of the counter. The first packet is transmitted. The
value of the counter is now decremented to 600.
b. The value of the counter is now 600; the size of the second packet (400
bits) is less than the value of the counter, so it is transmitted. The value of
the counter is now decremented to 200.
c. The value of the counter is now 200; the size of the third packet (400 bits)
is now larger than the value of the counter, so it cannot be transmitted. It
needs to wait for the next tick of time (next second).
d. The process repeats for every second. In each tick of time only two packets
can be sent. This means 800 bits per second or the rate of 0.8 Kbps. We
have reduced the rate from 4 Kbps to 0.8 Kbps.

P30-9. The following shows that the sender collects credits (tokens) that can be used
during the last three seconds. However, the sender loses some of the tokens
when the bucket becomes full because it uses very little during the first four
seconds and starts using the credits a little bit late.

Drop

Buckets

Seconds
0 1 2 3 4 5 6 7
Buffers
5

P30-11. To better understand the behavior of the leaky bucket in this problem, we first
create a table in each case to show the movement of cells in the system. The
flow diagram can follow the table. Although adding, removing, and dropping
cells are done for each individual cell, we assume that the cells are first added
to the queue, the ones that can be transmitted are removed from the queue, and
at the end of each second, the extra cells are dropped (discarded) if the queue
is full. Now we create the table and the flow diagrams for each case sepa-
rately.

a. The following shows the table for the first case. The table shows that there
are occasions when the queue is full and some cells are dropped (t12 to t16).

Previ- Number Total Number Number Number


(ti) ous of cells number of cells of cells of cells
number arrived of cells sent left in dropped
of cells in queue queue
in queue
01 0 5 5 5 0 0
02 0 5 5 5 0 0
03 0 5 5 5 0 0
04 0 5 5 5 0 0
05 0 5 5 5 0 0
06 0 5 5 5 0 0
07 0 5 5 5 0 0
08 0 15 15 10 5 0
09 5 15 20 10 10 0
10 10 15 25 10 15 0
11 15 15 30 10 20 0
12 20 15 35 10 20 5

13 20 15 35 10 20 5

14 20 15 35 10 20 5

15 20 15 35 10 20 5

16 20 15 35 10 20 5

17 20 0 20 10 10 0
18 10 0 10 10 0 0
19 0 0 0 0 0 0
20 0 0 0 0 0 0
6

The following shows the flow of cells graphically. The first seven seconds,
the ISP rate follows the rate of the customer, but the ISP rate is reduced (to
the maximum 10 cells per second. The customer sends 170 cells, but the
ISP sends only 145 cells, which means that 25 cells are lost. The third fig-
ure shows the number of cells left in the queue in each second. Since some
cells are queues and some not, this means that there is uneven delay
between the cells (jitter).

Cell rate
20
15
10
5

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Time
Cells arrived at ISP (170)

Cell rate
20
15
10
5

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Time
Cells cent by ISP (145)

Cells
Drop of 25 cells
20
15
10
5

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Time
Cells in the queue
7

b. The following shows the table for the second case. The table shows that
there is no cell lost. Although the customer sends more number of cells in
each second than its maximum rate, this only occurs only for four seconds
and does not overflow the queue.

Previ- Number Total Number Number Number


(ti) ous of cells number of cells of cells of cells
number arrived of cells sent left in dropped
of cells in queue queue
in queue

01 0 15 15 10 5 0

02 5 15 20 10 10 0

03 10 15 25 10 15 0

04 15 15 30 10 20 0

05 20 5 25 10 15 0

06 15 5 20 10 10 0

07 10 5 15 10 5 0

08 5 5 10 10 0 0

09 0 5 5 5 0 0

10 0 5 5 5 0 0

11 0 5 5 5 0 0

12 0 5 5 5 0 0

13 0 5 5 5 0 0

14 0 5 5 5 0 0

15 0 5 5 5 0 0

16 0 5 5 5 0 0

17 0 5 5 5 0 0

18 0 5 5 5 0 0

19 0 0 0 0 0 0

20 0 0 0 0 0 0
8

The following shows the flow of cells graphically. The customer sends 130
cells, the ISP also sends 130 cells. There is no cell loss, but there is a delay
because some of the cells need to be queued during the first four seconds.
The queueing delays all cells after the t5 (jitter). The queue first becomes
full, but it gradually becomes empty.

Cell rate

20
15
10
5

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Time
Cells arrived at ISP (130)

Cell rate

20
15
10
5

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Time
Cells cent by ISP (130)

Cells

20
15
10
5

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Time
Cells in the queue
9

c. The table for the third customer is shown below. The following shows the
table for the third case. This is another case in which there is no cell loss.

Previ- Number Total Number Number Number


(ti) ous of cells number of cells of cells of cells
number arrived of cells sent left in dropped
of cells in queue queue
in queue

01 0 0 0 0 0 0

02 0 0 0 0 0 0

03 0 20 20 10 10 0

04 10 20 30 10 20 0

05 20 0 20 10 10 0

06 10 0 10 10 0 0

07 0 20 20 10 10 0

08 10 20 30 10 20 0

09 20 0 20 10 10 0

10 10 0 10 10 0 0

11 0 20 20 10 10 0

12 10 20 30 10 20 0

13 20 0 20 10 10 0

14 10 0 10 10 0 0

15 0 20 20 10 10 0

16 10 20 30 10 20 0

17 20 0 20 10 10 0

18 10 0 10 10 0 0

19 0 0 0 0 0 0

20 0 0 0 0 0 0
10

The following shows the flow of cells graphically. This is a very interesting
case. Although, some cells are queues, but the cells are departed from the
ISP with even delays. If we think that the cells are created at the ISP, we
can say that, from t3 to t18 , ISP sends 10 cells per second.

Cell rate
20
15
10
5

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Time
Cells arrived at ISP (160)

Cell rate
20
15
10
5

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Time
Cells cent by ISP (160)

Cells

20
15
10
5

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Time
Cells in the queue
CHAPTER 31

PRACTICE SET

Questions
Q31-1. Only snooping is a threat to confidentiality. Masquerading and repudiation are
threats to integrity.

Q31-3. Only denial of service is a threat to availability. Repudiation and modification


are threats to integrity.

Q31-5. This is an example of steganography because the letter is covered by the seal.

Q31-7. This is an example of steganography because the message is hidden inside the
essay.

Q31-9. This is an example of symmetric-key cryptography because the same key is


used both for encryption and decryption. In asymmetric-key cryptography, a
public key should be used for encryption and a private key for decryption.

Q31-11. This is a monoalphabetic substitution cipher because changing depends on


what the character is, not on the position of the character.

Q31-13. The key in this case needs to be between 0 and 25 (although there is no cipher
if the key is 0). on average Eve needs to test 26/2 = 13 keys to break the code.

Q31-15. For the additive cipher, we use only one key. For the monoalphabetic cipher,
we use 26 keys. For the autokey cipher, we use 1000 keys.

Q31-17. This is a straight permutation because the number of inputs and the number of
outputs are the same.

Q31-19.

a. The inverse of a swap operation is another swap operation. In other words,


the swap operation is self-invertible.

1
2

b. The inverse of a shift right operation is a shift left operation using the same
number of bits to be shifted.
c. The inverse of a combine operation is a split operation.

Q31-21. Half of the input in DES is only 32 bits. The key is applied only to this 32-bit
section. The two inputs to an XOR should be of the same size. Since the key is
48 bits, we need to expand the 32-bit section to a 48-bit section using an
expansion P-box. Making the key for each round smaller jeopardizes the secu-
rity of DES.

Q31-23. The one-time pad is an ideal, but a theoretical, cipher; it cannot be imple-
mented easily because it requires that the sender and receiver have a secure
channel to exchange the key stream. However, it is controversial; if there is a
secure channel, the main message, in plaintext, can be sent through that chan-
nel.

Q31-25. To be safe, the keys used in asymmetric-key cryptography should be very


large. This makes the calculation very long if the message is also long. Com-
pare the short key of DES (56 bits) with the long key of RSA (500 to 1000
bits).

Q31-27. If e = 1, there is no encryption: C = P1 = P. If Eve intercepts the ciphertext, she


has the plaintext.

Q31-29. Message authentication and entity authentication both authenticate the sender
for the receiver. As their names indicate, however, message authentication
authenticates the sender for a particular message, while entity authentication
authenticates the sender for the entire session in which several messages can
be sent. If the sender is sending only a single message, message authentication
has the same effect as entity authentication; if a sender is sending several mes-
sages, one entity authentication authenticates the sender for all messages.

Q31-31

a. The first choice is actually very inefficient and not practical because Alice
needs to have a shared secret key between herself and each of the recipi-
ents. She also needs to create fifty separate MACs, one for each secret key.
b. Alice can use digital signature and sign only one message with her own
private key. She then sends a copy of the message to each recipient. Each
recipient needs to use Alice’s public key to verify the message.

Q31-33. Alice needs to use the public key of each recipient, which different for each of
them. This means Alice needs to use 100 public keys.

Q31-35. A KDC is designed to solve the problem of secret-key distribution.


3

Problems
P31-1.

a. This is snooping (an attack to confidentiality). Although the contents of the


test are not confidential on the day of the test, they are confidential before
the test day.
b. This is modification (an attack to integrity). The value of the check is
changed (from $10 to $100).
c. This is denial of service (an attack to availability). Sending so many e-
mails may crash the server and the service may be interrupted.

P31-3.

a. The ciphertext is NBCMCMUHYRYLWCMY as shown below:

Plaintext Encryption Ciphertext


t → 19 (19 + 20) mod 26 = 13 13 → N
h → 07 (07 + 20) mod 26 = 01 01 → B
i → 08 (08 + 20) mod 26 = 02 02 → C
s → 18 (18 + 20) mod 26 = 12 12 → M
i → 08 (08 + 20) mod 26 = 02 02 → C
s → 18 (18 + 20) mod 26 = 12 12 → M
a → 00 (00 + 20) mod 26 = 20 20 → U
n → 13 (13 + 20) mod 26 = 07 07 → H
e → 04 (04 + 20) mod 26 = 24 24 → Y
x → 23 (23 + 20) mod 26 = 17 17 → R
e → 04 (04 + 20) mod 26 = 24 24 → Y
r → 17 (17 + 20) mod 26 = 11 11 → L
c → 02 (02 + 20) mod 26 = 22 22 → W
i → 08 (08 + 20) mod 26 = 02 02 → C
s → 18 (18 + 20) mod 26 = 12 12 → M
e → 04 (04 + 20) mod 26 = 24 24 → Y
4

b. We can retrieve the plaintext by subtracting 20 from each ciphertext char-


acter using modulo 26 arithmetic as shown below:

Ciphertext Decryption Plaintext

N → 13 (13 − 20) mod 26 = 19 19 → t

B → 01 (01 − 20) mod 26 = 07 07 → h

C → 02 (02 − 20) mod 26 = 08 08 → i

M → 12 (12 − 20) mod 26 = 18 18 → s

C → 02 (02 − 20) mod 26 = 08 08 → i

M → 12 (12 − 20) mod 26 = 18 18 → s

U → 20 (20 − 20) mod 26 = 00 00 → a

H → 07 (07 − 20) mod 26 = 13 13 → n

Y → 24 (24 − 20) mod 26 = 04 04 → e

R → 17 (17 − 20) mod 26 = 23 23 → x

Y → 24 (24 − 20) mod 26 = 04 04 → e

L → 11 (11 − 20) mod 26 = 17 17 → r

W → 22 (22 − 20) mod 26 = 02 02 → c

C → 02 (02 − 20) mod 26 = 08 08 → i

M → 12 (12 − 20) mod 26 = 18 18 → s

Y → 24 (24 − 20) mod 26 = 04 04 → e

P31-5. The plaintext and ciphertext are shown below, ignoring the space:
Plaintext Ciphertext
an exercise (5, 5), (3, 3), (1, 5), (3, 1), (1, 5), (2, 2), (3, 5), (4, 4), (3, 2), (1, 5)

P31-7. We apply the key = 1, 2, 3, 4, 5, 6, and 7 to find the plaintext.

Ciphertext Key Plaintext


UVACLYZLJBL 1 tuzbkxeykiaxy
UVACLYZLJBL 2 styajwdxjhzwj
UVACLYZLJBL 3 rsxzivcwigyvi
UVACLYZLJBL 4 qrwyhubvhfxuh
UVACLYZLJBL 5 pqvxgtaugewtg
UVACLYZLJBL 6 opuwfsztfdvsf
UVACLYZLJBL 7 notverysecure
5

P31-9. The content of each element represents the input column number; the index
represents the output column number.

a. The encryption key can be represented as shown below.

3 1 4 5 2
1 2 3 4 5

b. The decryption key can be represented as shown below. Note that the
indexes are sorted.

2 5 1 3 4
1 2 3 4 5

c. We can first exchange the content and index and then sort the array accord-
ing to the index. For example, to get the decryption key from the encryp-
tion key in part a, we can first swap the contents and the index and then sort
it according to the index.
1: Swap 2: Sort
1 2 3 4 5 2 5 1 3 4
3 1 4 5 2 1 2 3 4 5

P31-11.

a. Swap of (10011011) is (10111001).


b. Swap of (10111001) is (10011011).
c. The original word in part a and the result of part b are the same, which
shows that swapping is a self-invertible operation.

P31-13. As we said about the keys for the transposition cipher, permutation boxes (P-
boxes) can be represented by a table in which the contents of each element
shows the input number and the index show the output number.

a. A straight permutation box of n × n size is a table of n entries in which each


entry is unique. A compression permutation of n × m size is a table of m
entries in which the blocked inputs are not shown. An expansion permuta-
tion of n × m size is a table of n entries in which some of the entries are
repeated. The following shows the three tables for permutation boxes. We
have not shown the indexes.

2 5 4 1 3 1 3 5 1 3 3 1 2
1 2 3 4 5 1 2 3 1 2 3 4 5
Straight Compression Expansion

b. The compression and expansion boxes have no inversions because the


number of inputs and outputs is not equal. Only the straight boxes can be
inverted. We first need to swap the contents and the indexes and then sort
6

the result according to the index. The following shows the inversion of a
straight permutation box used in the decryption.

1: Original 2: Swap 3: Reorder


2 5 4 1 3 → 1 2 3 4 5 → 4 1 5 3 2
1 2 3 4 5 2 5 4 1 3 1 2 3 4 5

P31-15. le. In other words, we need to show that the component NI is eliminated in the
decryption process.

Encryption: C1 = P1 ⊕ NI
Decryption: P2 = C2 ⊕ NI = C1 ⊕ NI = (P1 ⊕ NI) ⊕ NI = P1 ⊕ (NI ⊕ NI)
P2 = P1 ⊕ (0) = P1

P31-17. Both operations are keyless and the operations are predefined. If Eve, the
intruder, wants to break the cipher, she can easily simulate them.

P31-19. We first find the value of φ = (p − 1) × (q − 1) = 120. We then need to see


which of the e values satisfies the relation (d × e) mod 120 = 1. We will find
that 103 is the answer.

a. (7 × 11) mod 120 = 77


b. (7 × 103) mod 120 = 721 mod 120 = 1 (Answer is 103)
c. (7 × 19) mod 120 = 133 mod 120 = 13

P31-21. Two messages can easily have the same traditional checksum. For example,
two different messages in which two bytes are swapped will have the same
traditional checksum because the calculation of a traditional checksum is
independent from the position of the bytes. This means a traditional checksum
cannot be used as a cryptographic hash function.

P31-23. The following shows the new diagram. The timestamp, T, included in the only
message does the job of the challenge message and RB.

Encrypted with Alice-Bob secret key


T: Timestamp

Alice Bob
(claimant) (verifier)
Alice, T

P31-25. The following shows one simple solution. It shows the idea, but it is vulnera-
ble to some attacks. There are some better but more complicated solutions. In
7

the first message, Alice sends her identification and her nonce. In the second
message, Bob sends his identification, his nonce, and Alice’s encrypted nonce.
Alice’s nonce is encrypted with the shared secret key. When Alice receives
this message and decrypts her nonce, Bob is authenticated for her because
only Bob can encrypt Alice’s nonce with the shared secret key. In the third
message, Alice sends Bob’s encrypted nonce. When Bob receives this mes-
sage and decrypts his nonce, Alice is authenticated for Bob because only
Alice can encrypt Bob’s nonce with the shared secret key.

Encrypted with Alice-Bob secret key

RA A nonce sent by Alice RB A nonce sent by Bob Bob


Alice

1 Alice, RA

Bob is Bob, RB , RA 2
authenticaed

3 RB Alice is
authenticaed

P31-27. The following shows the new diagram. Two nonces and two keys are used to
achieve bidirectional authentication.

SigA: Signed with Alice’s private key

SigB: Signed with Bob’s private key

Alice Bob
(claimant) (verifier)

1 Alice

RB 2

3 RA, Bob, SigA (RB, Bob)

Alice, SigB (RA, Alice) 4


8

P31-29. The following shows the value of the digest after hashing each character of the
text. The method is not secure because the digest is always between 0 and 25.
The total number of possible digests is N = 26.

Initial value of the digest: d = 00


After hashing the first character (H: 07): d = (00 + 07) mod 26 = 07
After hashing the second character (E: 04): d = (07 + 04) mod 26 = 11
After hashing the third character (L: 11): d = (11 + 11) mod 26 = 22
After hashing the fourth character (L: 11): d = (22 + 11) mod 26 = 07
After hashing the fifth character (O: 14): d = (07 + 14) mod 26 = 21
CHAPTER 32

PRACTICE SET

Questions
Q32-1. IPSec needs a set of security parameters before it can be operative. In IPSec,
the establishment of the security parameters is done via a mechanism called
security association (SA).

Q32-3. The two protocols defined by IPSec for exchanging datagrams are Authentica-
tion Header (AH) and Encapsulating Security Payload (ESP).

Q32-5. The Encapsulating Security Payload (ESP) protocol adds an ESP header, ESP
trailer, and the digest. The ESP header contains the security parameter index
and the sequence number fields. The ESP trailer contains the padding, the
padding length, and the next header fields. Note that the digest is a field sepa-
rate from the header or trailer.

Q32-7. The two dominant protocols for providing security at the transport layer are
the Secure Sockets Layer (SSL) Protocol and the Transport Layer Security
(TLS) Protocol. The latter is actually an IETF version of the former.

Q32-9. A session between two systems is an association that can last for a long time;
a connection can be established and broken several times during a session.
Some of the security parameters are created during the session establishment
and are in effect until the session is terminated. Some of the security parame-
ters must be recreated (or occasionally resumed) for each connection.

Q32-11. One of the protocols designed to provide security for email is Pretty Good Pri-
vacy (PGP). PGP is designed to create authenticated and confidential e-mails.

Q32-13. The Handshake Protocol establishes a cipher set and provides keys and secu-
rity parameters. It also authenticates the server to the client and the client to
the server, if needed.

Q32-15. A firewall is a security mechanism that stands between the global Internet and
a network. A firewall selectively filters packets.

1
2

Q32-17. A VPN is a virtual network that uses VPN technology.The technology allows
an organization to use the global Internet yet safely maintain private internal
communication.

Problems
P32-1. When IPSec is used in the transport mode, two parties need to first create
cryptographic secrets between themselves before exchanging secure data.
This cannot be done using the connectionless service provided by IP. The two
parties need to create a virtual connection-oriented service between them-
selves over the services provided by IP. This is done using the Security Asso-
ciation (SA) described in the text.

P32-3. Although it is possible to create an SA permanently, it is strongly discouraged


because of the leak of security parameters. With the passage of time, Eve may
find the secrets between Alice and Bob and misuse them.

P32-5. An SA provides two services for IPSec: it creates a virtual connection and
establishes security parameters between the two parties. The first service is
not needed in the case of SSL because SSL runs over TCP, which is a connec-
tion-oriented protocol. The second service of SA is provided by the handshake
protocol in SSL.

P32-7. The handshake protocol in SSL should start its function after the three-way
handshaking in TCP because the handshaking protocol in SSL does not create
a connection; it uses the connection established by TCP to exchange security
parameters.

P32-9. Alice creates a message digest and signs it with her private key. She then
sends the message and the signed digest.

P32-11. Alice creates a message digest from the content. Alice then sends the digest,
the hash algorithm, and the content. The whole is referred to as digestedData
object.

P32-13. Alice uses an envelopedData. She creates a random number as the session
key. She then encrypts the session key with Bob’s public key. The message is
encrypted with the session key.

P32-15. In e-mail communication, there is no virtual connection between the two par-
ties. Each e-mail is a unidirectional communication between the sender and
receiver. This means that there cannot be entity authentication in PGP or in S/
MIME. When we talk about authentication in PGP or S/MIME, we mean mes-
sage authentication.

Вам также может понравиться