16
NETWORK PROBLEM SET Solution Problem 1 Consider a packet-switched network of N nodes connected by the following topologies: 1. For a packet-switched network of N nodes, the number of hops is one less than the number of nodes visited. Star: for a star topology, the fixed number of hops is 2. Loop: for a loop topology, the furthest distance from a source node is situated at N/2 hops if the number of nodes in the loop is even and at (N1) /2 hops if the number of nodes in the loop is odd. Fully Connected: for a fully connected topology, each node is directly connected to all other nodes. Therefore, the number of hops is simply 1. The average Length for different topologies: Star: For a star topology, the fixed number of hops is 2. Loop: The average number depends on whether the total number of nodes is odd or even. Even Case: Notice that there are 2 nodes located at i hops from the source, for 1 <= i <= N/2 1, and only one node, the furthest from the source, located at N/2 hops from the source. Therefore, the average number of hops, H, is: H = 2/( 1)( ) + ! ! ( ! ! !!) !!! H = N ! /(4 N 1 ) Odd Case: In this case, there are exactly 2 nodes located at i hops from the source, for 1 <= i <= (N1)/2. Therefore, the average number of hops, H, is: H = 2/( 1)( ) ( ! ! !!) !!! H = (N + 1)/4 Fully connected: For such a topology, the average number of hops is 1. 1. Since a tree is defined to be any geometry which interconnects all nodes so that there is a single path between any two nodes but not loops or circuits, a tree can be formed from any ring configuration by deleting one link. Thus, for any ring configuration, a tree configuration with shorter total length can be found and the minimum possible total length of any tree must be shorter than the minimum possible total length of any ring.

Solution - Southeast Universitycse.seu.edu.cn/PersonalPage/wyang/NetHwkSetFnlSol_1.pdf · Solution Problem 1 Consider a packet-switched network of N nodes ... The delay variation,

Embed Size (px)

Citation preview

Page 1: Solution - Southeast Universitycse.seu.edu.cn/PersonalPage/wyang/NetHwkSetFnlSol_1.pdf · Solution Problem 1 Consider a packet-switched network of N nodes ... The delay variation,

NETWORK  PROBLEM  SET  Solution

Problem 1

Consider a packet-switched network of N nodes connected by the following topologies:

1. For a packet-switched network of N nodes, the number of hops is one less than the number of nodes visited.

• Star: for a star topology, the fixed number of hops is 2. • Loop: for a loop topology, the furthest distance from a source node is situated at

N/2 hops if the number of nodes in the loop is even and at (N−1) /2 hops if the number of nodes in the loop is odd.

• Fully Connected: for a fully connected topology, each node is directly connected to all other nodes. Therefore, the number of hops is simply 1.

The average Length for different topologies:

• Star: For a star topology, the fixed number of hops is 2. • Loop: The average number depends on whether the total number of nodes is odd

or even. § Even Case: Notice that there are 2 nodes located at i hops from the source,

for 1 <= i <= N/2 − 1, and only one node, the furthest from the source, located at N/2 hops from the source. Therefore, the average number of hops, H, is:

H = 2/(𝑁 − 1)( 𝑖)+ !!

(!!!!)

!!!

H =  N!/(4 N− 1 )

§ Odd Case: In this case, there are exactly 2 nodes located at i hops from the source, for 1 <= i <= (N−1)/2. Therefore, the average number of hops, H, is:

H = 2/(𝑁 − 1)( 𝑖)(!!!!)!!!

H   = (N+ 1)/4 • Fully connected: For such a topology, the average number of hops is 1.

1. Since a tree is defined to be any geometry which interconnects all nodes so that there is a

single path between any two nodes but not loops or circuits, a tree can be formed from any ring configuration by deleting one link. Thus, for any ring configuration, a tree configuration with shorter total length can be found and the minimum possible total length of any tree must be shorter than the minimum possible total length of any ring.

Page 2: Solution - Southeast Universitycse.seu.edu.cn/PersonalPage/wyang/NetHwkSetFnlSol_1.pdf · Solution Problem 1 Consider a packet-switched network of N nodes ... The delay variation,

Problem 2

A parent on travel wishes to establish a conversation with his young son over a communication network. The parent was concerned that the communication will not be of good quality, if they are too far of each other. Assume that the speed of sound is approximately 330 meters/second. Also, assume that the network transmits the sound at the speed of light in cable, 2.3 x 108

meters/second.

1. The delay for the sound when the parent and his child are 10 meters apart is t10 = 10/330 = 30.30 milliseconds. The maximum distance is the time required for a real-time “experience” times the cable speed. Therefore, d = (2.3 x 108) x (30.30 x 10-3) = 6,969,000 meters = 6969 kilometers.

2. The delay variation, jitter, and consecutive packet loss, when the network is congested, also impact the quality of the sound.

Page 3: Solution - Southeast Universitycse.seu.edu.cn/PersonalPage/wyang/NetHwkSetFnlSol_1.pdf · Solution Problem 1 Consider a packet-switched network of N nodes ... The delay variation,

Problem 3 (Hw2 Sol)

1. Suppose the size of an uncompressed text file is 1 megabyte. a. How long does it take to download the file over a 32 kilobit/second

modem? a. T32k = 8 (1024) (1024) / 32000 = 262.144 seconds

b. How long does it take to take to download the file over a 1 megabit/second

modem? b. T1M = 8 (1024) (1024) bits / 106 bits/sec = 8.38 seconds

2. Suppose data compression is applied to the 1 megabyte text file. Assuming a

compression ratio of 1:6: a. How long does it take to download the compressed file over a 32

kilobits/second modem? a. T32k = 8 (1024) (1024) / (32000 x 6) = 43.69 sec

b. How long does it take to take to download the compressed file over a 1

megabits/second modem? b. T1M = 8 (1024) (1024) / (106 ∙ 6) = 1.4 sec

3. A scanner has a resolution of 600 x 600 pixels/square inch. Assume that an 8-

inch x 10-inch image is scanned and transmitted over the network: The number of pixels is 600x600x8x10 = 28.8 106 pixels per picture.

a. If scanning uses 8 bits/pixel, how long does it take to send the scanned image over a 32 kilobits/second modem?

a. With 8 bits/pixel representation, we have: 28.8∙106 ∙ 8 = 230.4 Mbits per picture. It takes (230.4∙106)/(32∙103) = 7.2 103 sec.

b. If scanning uses 24 bits/pixel, how long does it take to send the scanned image over a 1 megabits/second modem?

b. With 24 bits/pixel representation, we have: 28.8x106 ∙ 24 = 691.2 Mbits per picture. It takes (691.2∙106)/(106) = 691.2 sec.

Page 4: Solution - Southeast Universitycse.seu.edu.cn/PersonalPage/wyang/NetHwkSetFnlSol_1.pdf · Solution Problem 1 Consider a packet-switched network of N nodes ... The delay variation,

Problem 4

Define the following parameters for a communication network:

• N = number of hops between two given end systems, • L = message length in bits, • B = data rate, in bits per second (bps), on all links, • P = packet size • H = overhead (header) bits per packet, and • S = call setup time (circuit switching or virtual, and • D = propagation delay.

Assume that N = 4, L = 3200, B = 9600, P = 1024, H = 16, S = 0.2, and D = 0.001 and that the queuing delay and processing overhead are ignored.

(a) The end-to-end delay for circuit switching is:

T = C1 + C2, where

• C1 = Call setup time, • C2 = Message delivery time. • C1 = S = 0.2 sec. • C2 = Propagation Delay + Transmission Time. Therefore, C2 = N×D+ L/B = 4×

0.001+(3200/9600) = 0.337 sec. • T = 0.2 + 0.337 = 0.537 sec.

(b) The end-to-end delay for packet switching is:

T = D1 + D2 + D3 + D4, where

• D1 = Time to transmit and deliver all packets through the first hop, • D2 = Time to deliver the last packet acros the second hop, • D3 = Time to deliver the last packet across the third hop, and • D4 = Time to deliver the last packet across the forth hop.

There are P H = 1024 16 = 1088 data bits per packet. A message of 3200 bits requires four packets.

Therefore:

• D1 = 4 × t + p, where – t = transmission time for one packet, – p = propagation delay for one hop.

• D1 = 4 × P/B + D = 4 × 1024/9600 + 0.001 = 0.428 sec.

Page 5: Solution - Southeast Universitycse.seu.edu.cn/PersonalPage/wyang/NetHwkSetFnlSol_1.pdf · Solution Problem 1 Consider a packet-switched network of N nodes ... The delay variation,

• D2 = D3 = D4 = t + p = P/B + D = 0.108 sec. • T = 0.752 sec.

Notice that the above solution assumes that the last packet is padded to a full size packet. If padding of the last packet is not allowed, the transmission of the unpadded packet takes only 0.2363, and the total transmission T = 0.667.

Page 6: Solution - Southeast Universitycse.seu.edu.cn/PersonalPage/wyang/NetHwkSetFnlSol_1.pdf · Solution Problem 1 Consider a packet-switched network of N nodes ... The delay variation,

Problem 5

Consider a city with a population of 1 million. Assume that at any given time of the day, only 1% of the people in the city are using the phone.

1. If a voice call requires 64 Kbps, the number of people on the phone at a given time is 106 ∙10–2 = 104, so the total bit rate is 104 ∙  64 ∙103 = 640 megabits per second.

2. If high-quality videoconferencing is used and the bit rate is increased to 1.4 Mbps, then the total bit rate increases to 14 Gbps.

Page 7: Solution - Southeast Universitycse.seu.edu.cn/PersonalPage/wyang/NetHwkSetFnlSol_1.pdf · Solution Problem 1 Consider a packet-switched network of N nodes ... The delay variation,

Problem 6

Suppose two friends want to communicate secretly using the following code:

• If the bit in the original message has value 1, then the bit is replaced with the secret code word 111;

• If the bit in the original message has value 0, then the bit is replaced with the secret code word 000;

1. The receiver makes a decoding error if two or more out of the three bits are in error. Therefore,

Perror = 3p2(1 – p) + p3 = 3(10-3)2 (1-10-3) + (10-3)3 ≈ 3(10-6) 2. Assume now that instead of using the majority vote rule, the sender adds two check bits

to a group of 2n information bits. The first check bit is the parity check of the first n bits, and the second check bit is the parity check of the second n bits. What error patterns can the receiver detect using the above code?

2. If we rearrange the 2n information bits and the 2 parity bits into two code words, each consisting of n information bits and a parity bit, we see that in effect we have divided the overall code word into two sub-code words of length n + 1. An error pattern is detectable if the error pattern in the first code word and in the second code word are both detectable. An error pattern in each sub-code word is detectable if the number of errors in the sub-code word is odd. Therefore an error pattern is detectable if the number of errors in both sub-code words is odd.

3. Assuming that the channel has a bit error rate p = 10-3, and that bit errors occur at random and independently of each other, find the probability that a failure remains undetected?

3. An error detection failure occurs is either the first sub-code word or the second sub-code word or both failed. Let Pdetect (n + 1) be the probability of successful error detection in the single parity code of length n + 1, then

P [detection failure in code of length 2n + 2] =

1 – P [successful detection in both codes of length n + 1]

1 – Pdetect (n + 1) Pdetect (n + 1)

Pdetect (n + 1) = P [exactly (2i+1) bits out of (n+1) bits are in error; < (𝑛 + 1)/2 ]

Pdetect (n + 1) = !!!!!!! 𝑝

(!!!!)(1− 𝑝)!!!!!!(!!!)/!

!!!

Page 8: Solution - Southeast Universitycse.seu.edu.cn/PersonalPage/wyang/NetHwkSetFnlSol_1.pdf · Solution Problem 1 Consider a packet-switched network of N nodes ... The delay variation,

Problem 7 (13-Hw2)

1. Using the CRC-CCITT polynomial (x16 + x12 + x5 + 1), generate the 16-bit CRC code for a message consisting of a 1 followed by 15 0s.

1. Answer – The 16-bit CRC code is: 0001101110011000

2. Let G(x) = x5 + x4 + x + 1 be the polynomial generator and M = 11100011. Find the CRC for this message.

2. Answer – The CRC of the message is: 11010

3. Let G(x) = x5 + x4 + x2 + 1 be the polynomial generator, T = 101000110101110 be the message received by the destination node. Would the receiver accept the message? Why?

3. Answer – Dividing the received frame by G(x) results in a remainder of 0. It can be concluded that the frame is not in error. The receiver should, therefore, accept the frame.

4. In a CRC error-detecting scheme, choose G(x) = x4 + x + 1. a. Encode the bits 10010011011. a. Answer – Divide X10 + X7 + X4 + X3 + X + 1 by X4 + X + 1. The

remainder is X3 + X2. The CRC bits are 1100. The string 100100110111100 is sent.

b. Suppose the channel introduces an error pattern 100010000000000 (i.e., the channel flips a bit from 0 to 1 or 1 to 0 in position 1 and 5). Show the message that is received. Can the error be detected?

b. Answer – The string 000110110111100 is received, corresponding to X11 + X10 + X8 + X7 + X5 + X4 + X3 + X2. The remainder after division by X4 + X + 1 is X3 + X2 + X is nonzero. The errors are detected.

c. Repeat (b) with error pattern 10001100000000. Show the message received. Can the error bit detected?

c. Answer – The string 000111110111100 is received, corresponding to X10 + X8 + X7 + X5 + X4 + X3 + X2. The remainder after division by X4 + X + 1 is nonzero. The errors are detected.

Page 9: Solution - Southeast Universitycse.seu.edu.cn/PersonalPage/wyang/NetHwkSetFnlSol_1.pdf · Solution Problem 1 Consider a packet-switched network of N nodes ... The delay variation,

Problem 8 (13-Hw2)

Consider the use of 1000-bit frames on a 1-Mbps satellite channel with 270-ms delay. We define the throughput, T, of a channel as follows as the number of bits transmitted per second. We assume that the channel is error free and the processing time of frames and acknowledgments is negligible. What is the maximum throughput (bits per second) for the following flow control schemes?

1. Stop-and-wait flow control? 2. Sliding window flow control with a window size of 7? 3. Sliding window flow control with a window size of 127? 4. Sliding window flow control with a window size of 255?

Consider the use of 1000-bit frames on a 1-Mbps satellite channel with 270-ms delay. We define the throughput, T, of a channel as follows as the number of bits transmitted per second. We assume that the channel is error free and the processing time of frames and acknowledgments is negligible. What is the maximum throughput (bits per second) for the following flow control schemes?

Let TF represent the time to transmit a frame, UL represent the link utilization and W denote the window size. UL can be defined as:

UL = (W TF)/2D, where D is the one way satellite delay

TF = 1000/1o6 = 10-3 sec; D= 540 msec.

1. Stop-and-wait flow control? 1. W=1: UL = 10-3/(540∙10-3)= 0.0019

2. Sliding window flow control with a window size of 7? 2. W=7; UL = 7(10-3/(540∙10-3))= 0.013

3. Sliding window flow control with a window size of 127? 3. W=127; UL = 127(10-3/(540∙10-3))= 0.235185185

4. Sliding window flow control with a window size of 255? 4. W=255; UL = 255(10-3/(540∙10-3))= 0.47

Page 10: Solution - Southeast Universitycse.seu.edu.cn/PersonalPage/wyang/NetHwkSetFnlSol_1.pdf · Solution Problem 1 Consider a packet-switched network of N nodes ... The delay variation,

Problem 9

1. Given the two main reasons for why Ethernet must specify a minimum frame size

a. First, it makes it easier to distinguish between valid frame and garbage. b. Second, if the frame is too short, the transmission will be finished before the

collision signal returns. The worst case takes 2τ, where τ is the propagation delay. Therefore, the frame has to be longer than 2 τ.

2. Consider building a CSMA/CD network running at 1 Gbps over a 1-km cable with no

repeaters. The signal speed in the cable is 200,000 km/sec. What is the minimum frame size?

• Suppose the frame size is f, transmission rate is r, and propagation delay is t. • Then f/r ≥ 2*t; ==> • f ≥ r * 2 * t = 1 Gbps * 2 * (1km / 200000km/s); • ==> f ≥ 10,000 bits • ==> f ≥ 1,250 bytes.

Page 11: Solution - Southeast Universitycse.seu.edu.cn/PersonalPage/wyang/NetHwkSetFnlSol_1.pdf · Solution Problem 1 Consider a packet-switched network of N nodes ... The delay variation,

Problem 10

1. The IP header checksum only verifies the integrity of IP header. Discuss the pros and cons of doing the checksum on the header part versus on the entire packet.

Error checking in the header is more important because the packet is routed according to the header information. In addition, the delivery of the data at the destination to the higher layers also requires the header information. Thus error checking of the header protects against incorrect delivery of the information. Restricting the error checking to the header also simplifies the implementation in the nodes, requires less checksum bits, and prevents unnecessary packet discard. Some higher layers can tolerate some data errors, and higher layers also have the option of performing retransmission.

2. Identify the range of IPv4 addresses spanned by Class A, Class B, and Class C.

The range of IPv4 addresses spanned by each class is: Class A: 1.0.0.0 to 127.255.255.255 Class B: 128.0.0.0 to 191.255.255.255 Class C: 192.0.0.0 to 223.255.255.255

3. What are all the possible subnet masks for the Class C address space? List all the subnet masks in dotted- decimal notation, and determine the number of hosts per subnet supported for each subnet mask.

255.255.255.128 supports 126 hosts (not including the broadcast address) 255.255.255.192 supports 62 hosts 255.255.255.224 supports 30 hosts 255.255.255.240 supports 14 hosts 255.255.255.248 supports 7 hosts 255.255.255.252 supports 3 hosts 255.255.255.254 and 255.255.255.255 are not practically usable.

4. Assuming a Classless address space, perform CIDR aggregation on the following /24 IP addresses: 128.56.24.0/24, 128.56.25.0/24 and 128.56.26.0/24.

128.56.24.0/22 = 10000000.00111000.00011000.00000000 128.56.25.0/22 = 10000000.00111000.00011001.00000000 128.56.26.0/22 = 10000000.00111000.00011010.00000000 128.56.27.0/22 = 10000000.00111000.00011011.00000000 Mask = 11111111.11111111.11111100.00000000

The resulting prefix is 128.56.24.0/22.

5. Perform CIDR aggregation on the following /24 IP addresses: 200.96.86.0/24; 200.96.87.0/24; 200.96.88.0/24; 200.96.89.0/24.

200.96.86.0/20 = 11001000.01100000.01010110.00000000 200.96.87.0/20 = 11001000.01100000.01010111.00000000 200.96.88.0/20 = 11001000.01100000.01011000.00000000

Page 12: Solution - Southeast Universitycse.seu.edu.cn/PersonalPage/wyang/NetHwkSetFnlSol_1.pdf · Solution Problem 1 Consider a packet-switched network of N nodes ... The delay variation,

200.96.89.0/20 = 11001000.01100000.01011001.00000000 Mask = 11111111.11111111.11110000.00000000

The resulting prefix is 200.96.80.0/20.

Page 13: Solution - Southeast Universitycse.seu.edu.cn/PersonalPage/wyang/NetHwkSetFnlSol_1.pdf · Solution Problem 1 Consider a packet-switched network of N nodes ... The delay variation,

Problem 11

1. A small organization has a Class C address for seven networks each with 24 hosts. What is an appropriate subnet mask?

Solution:

A Class C address requires 21 bits for its network ID, leaving 8 bits for the host ID and subnet ID to share. One possible scheme would assign 4 bits to the host and 4 to the subnet ID, as shown below. The number of bits assigned to the host can also be increased to 5.

Network ID Subnet ID Host ID 0 23 24 27 28 31

Subnet mask: 255.255.255.224

2. A university has one Class B address and 150 LANs with 100 hosts in each LAN. a. Design an appropriate subnet addressing scheme.

A Class B address has 14 bits for the network ID and 16 bits for the host ID. To design an appropriate subnet addressing scheme we need to decide how many bits to allocate to the host ID versus the subnet ID. Note that either 8 or 7 bits can be used to identify the hosts.

Selecting 8 bits to identify the host, leaves enough bits in the subnet ID field for up to 28 = 256 LANs. The number of bits in the host ID field is 8. Excluding all 0s and all 1s addresses, the maximum number of hosts in each LAN is (28 - 2) = 254. The subnet mask is 255.255.255.0.

1 0 Network ID Subnet ID Host ID 0 1 15 16 24 25 31

Selecting 7 bits to identify the host, leaves enough bits in the subnet ID field for up to 29 = 512 LANs. Excluding all 0s and all 1s addresses, the maximum number of hosts in each LAN is (27 - 2) = 124. The subnet mask in this case is 255.255.255.128.

1 0 Network ID Subnet ID Host ID 0 1 15 16 23 24 31

The choice between 7 or 8 bits to represent the hosts depends on the projected growth of the organization. If the number of LANs is expected to increase, then the host ID should be set to 7bits. Otherwise, the choice should be 8 bits. An alternate solution would be to use a variable-length prefix scheme using 7-bit host addresses to allow for aggregation and provide for greater flexibility in accommodating future changes.

Page 14: Solution - Southeast Universitycse.seu.edu.cn/PersonalPage/wyang/NetHwkSetFnlSol_1.pdf · Solution Problem 1 Consider a packet-switched network of N nodes ... The delay variation,

b. Design an appropriate CIDR addressing scheme.

CIDR addressing scheme involves devising a prefix length that indicates the length of the network mask. In this case, 8 bits are required to identify each LAN (since 127 < 150 < 255) and 7 bits are required to identify each host in each LAN (since 63 < 100 < 127). Therefore a CIDR address would use a 17-bit prefix, and thus have an address of the form address/17.

Page 15: Solution - Southeast Universitycse.seu.edu.cn/PersonalPage/wyang/NetHwkSetFnlSol_1.pdf · Solution Problem 1 Consider a packet-switched network of N nodes ... The delay variation,
Page 16: Solution - Southeast Universitycse.seu.edu.cn/PersonalPage/wyang/NetHwkSetFnlSol_1.pdf · Solution Problem 1 Consider a packet-switched network of N nodes ... The delay variation,

Problem 12

1. Suppose an application layer entity wants to send an L-byte message to its peer process, using an existing TCP connection. The TCP segment consists of the message plus 20 bytes of header. The segment is encapsulated into an IP packet that has an additional 20 bytes of header. The IP packet in turn encapsulated inside an Ethernet frame that has 18 bytes of header and trailer. What percentage of the transmitted bits in the physical layer correspond to message information, if L = 1000 bytes?

TCP/IP over Ethernet allows data frames with a payload size up to 1460 bytes. Therefore, L = 1000 bytes are within this limit.

The message overhead includes:

• TCP: 20 bytes of header • IP: 20 bytes of header • Ethernet: total 18 bytes of header and trailer.

Therefore, for L = 1000 bytes, 1000/1058 = 95% efficiency.

2. Suppose that the TCP entity receives a 1.5 megabyte file from the application layer and that the IP layer is willing to carry blocks of maximum size 1500 bytes. Calculate the amount of overhead incurred from segmenting the file into packet-sized units.

1500 - 20 -20 = 1460 bytes 1.5 Mbyte / 1460 byte = 1027.4; Therefore 1028 blocks are needed to transfer the file. Overhead = ((1028 x 1500 - 1.5M)/1.5M) x 100 = 2.8%

3. Consider a TCP that implements an extension to allow for window sizes much larger than 64 KB. Suppose that the extended TCP is used over a 1-Gpbs link with a latency of 99 ms to transfer a 10-MB file. Assuming that (i) TCP receiver’s window is 1 MB, (ii) TCP sends 1-KB packets, (iii) no congestion and (iv) no lost packets, how many RTTs does it take until slow start opens the send window to 1 MB? In slow start, the size of the window doubles every RTT. At the end of the ith RTT, the window size is 2i KB. It will take 10 RTTs before the send window has reached 210 KB = 1MB.