Top Banner
EE 471/ CS 471 /CS 573: Fall 2011-2012 Homework 5 Solution Instructor: Zartash Afzal Uzmi Due on Dec 13 th , 2011 Solution by Muhammad Fahad Manzoor and Zartash Afzal Uzmi
18

28_hw5-sol

Apr 21, 2015

Download

Documents

kisibongdem1412
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 28_hw5-sol

EE 471/ CS 471 /CS 573: Fall 2011-2012

Homework 5 Solution

Instructor: Zartash Afzal Uzmi

Due on Dec 13th, 2011

Solution by

Muhammad Fahad Manzoor and Zartash Afzal Uzmi

Page 2: 28_hw5-sol

Handout # 28 EE 471/ CS 471 /CS 573: Fall 2011-2012 Due on Dec 13th, 2011

Review Question 3

Consider a TCP connection between Host A and Host B. Suppose that the TCP segments travelling from

Host A to Host B have source port number x and destination number port number y. What are the source

and destination for segments travelling from Host B to Host A?

Answer

Source port number y and destination port number x.

Review Question 5

Why is it that voice and video traffic is often sent over TCP rather than UDP in today’s Internet.(Hint :

The answer we are looking for has nothing to with TCP’s congestion-control mechanism.)

Answer

Since most firewalls are configured to block UDP traffic, using TCP for video and voice traffic

lets the traffic though the firewalls.

Review Question 7

Suppose a process in Host C has a UDP socket with port number 6789. Suppose both Host A and Host

B each send a UDP segment to Host C with destination port number 6789. Will both of these segments

be directed to the same socket at Host C? If so, how will process at Host C know that these two segments

originated from two different hosts?

Answer

Yes, both segments will be directed to the same socket. For each received segment, at the socket

interface, the operating system will provide the process with the IP addresses to determine the

origins of the individual segments.

Review Question 8

Suppose that a Web server runs in Host C on port 80. Suppose this Web server uses persistent connections,

and is currently receiving requests from two different Hosts, A and B. Are all of the requests being sent

through the same socket at Host C? If they are being passed through different sockets, do both of the sockets

have port 80? Discuss and explain.

Answer

For each persistent connection, the Web server creates a separate connection socket. Each con-

nection socket is identified with a four-tuple: (source IP address, source port number, destination

IP address, destination port number). When host C receives and IP datagram, it examines these

four fields in the datagram/segment to determine to which socket it should pass the payload of

the TCP segment. Thus, the requests from A and B pass through different sockets. The identifier

for both of these sockets has 80 for the destination port; however, the identifiers for these sockets

have different values for source IP addresses. Unlike UDP, when the transport layer passes a

TCP segments payload to the application process, it does not specify the source IP address, as

this is implicitly specified by the socket identifier.

Review Question 14 continued on next page. . . Page 2 of 18

Page 3: 28_hw5-sol

Handout # 28 EE 471/ CS 471 /CS 573: Fall 2011-2012 Due on Dec 13th, 2011

Review Question 14

True or false?

(a) Host A is sending Host B a large file over a TCP connection. Assume Host B has no data to send to Host

A. Host B will not send acknowledgements to Host A because Host B cannot piggyback the acknowledgements

on data.

(b) The size of the TCP rwnd never changes throughout the duration of the connection.

(c) Suppose Host A is sending Host B a large file over TCP connection. The number of unacknowledged

bytes that A sends cannot exceed the size of receive buffer.

(d) Suppose Host A is sending a large file to Host B over TCP connection. If the sequence number for a

segment of this connection is m, then the sequence number of subsequent segment will necessarily be m+1.

(e) The TCP segment has a field in its header for rwnd.

(f) Suppose that the last SampleRTT in a TCP connection is equal to 1 sec. The current value of TimeoutInterval

for the connection will necessarily be ≥ 1 sec.

(g) Suppose Host A sends one segment with sequence number 38 and 4 bytes of data over TCP connection

to Host B. In this same segment the acknowledgement number is necessarily 42.

Answer

(a) false

(b) false

(c) true

(d) false

(e) true

(f) false

(g) false

Problem 13

Consider a reliable data transfer protocol that uses only negative acknowledgements. Suppose the sender

sends data only infrequently. Would a NAK-only protocol be preferable to a protocol that uses ACKs?

Why? Now suppose the sender has a lot of data to send and end-to-end connection experiences few losses.

In this second case, would a NAK-only protocol be preferable to a protocol that uses ACKs? Why?

Answer

In a NAK only protocol, the loss of packet x is only detected by the receiver when packet x+ 1

is received. That is, the receivers receives x− 1 and then x+1, only when x+1 is received does

the receiver realize that x was missed. If there is a long delay between the transmission of x and

the transmission of x+1, then it will be a long time until x can be recovered, under a NAK only

protocol.

Page 3 of 18

Page 4: 28_hw5-sol

Handout # 28 EE 471/ CS 471 /CS 573: Fall 2011-2012 Due on Dec 13th, 2011

Figure 1: Figure 3.17 referred in Problem 14 of Chapter 3

On the other hand, if data is being sent often, then recovery under a NAK-only scheme could

happen quickly. Moreover, if errors are infrequent, then NAKs are only occasionally sent (when

needed), and ACK are never sent – a significant reduction in feedback in the NAK-only case over

the ACK-only case.

Problem 14

Consider the cross-country example shown in Figure 3.17. How big would the window size have to be for the

channel utilization to be greater than 95 percent? Suppose that the size of packet is 1,500 bytes, including

both header fields and data.

Answer

It takes 12 microseconds (or 0.012 milliseconds) to send a packet, as 1500×8

109= 12 microseconds.

In order for the sender to be busy 95 percent of the time, we must have

utility = 0.95 =0.012n

30.012

Therefore n is approximately 2736 packets

Problem 19

Consider the GBN protocol with a sender window size of 3 and a sequence number range of 1,024. Suppose

that at time t, the next in-order packet that receiver is expecting has a sequence number of k. Assume that

the medium does not reorder messages. Answer the following questions:

(a) What are the possible sets of sequence numbers inside the sender’s window at time t? Justify your

answer.

(b) What are all possible values of the ACK field in all possible messages currently propagating back to the

sender at time t? Justify your answer.

Answer

Page 4 of 18

Page 5: 28_hw5-sol

Handout # 28 EE 471/ CS 471 /CS 573: Fall 2011-2012 Due on Dec 13th, 2011

(a) Here we have a window size of N=3. Suppose the receiver has received packet k-1, and has

ACKed that and all other preceeding packets. If all of these ACK’s have been received by sender,

then sender’s window is [k, k+N-1]. Suppose next that none of the ACKs have been received at

the sender. In this second case, the sender’s window contains k-1 and the N packets up to and

including k-1. The sender’s window is thus [k-N,k-1]. By these arguments, the senders window

is of size 3 and begins somewhere in the range [k-N,k].

(b) If the receiver is waiting for packet k, then it has received (and ACKed) packet k-1 and the

N-1 packets before that. If none of those N ACKs have been yet received by the sender, then

ACK messages with values of [k-N,k-1] may still be propagating back. Because the sender has

sent packets [k-N, k-1], it must be the case that the sender has already received an ACK for

k-N-1. Once the receiver has sent an ACK for k-N-1 it will never send an ACK that is less that

k-N-1. Thus the range of in-flight ACK values can range from k-N-1 to k-1.

Problem 21

Consider the GBN and SR protocols. Suppose the sequence number space is of size k. What is the largest

allowable sender window that will avoid the occurrence of problems such as that in Figure 3.27 for each of

these protocols?

Figure 2: Figure 3.27 referred in Problem 21 of Chapter 3

Page 5 of 18

Page 6: 28_hw5-sol

Handout # 28 EE 471/ CS 471 /CS 573: Fall 2011-2012 Due on Dec 13th, 2011

Answer

In order to avoid the scenario of Figure 3.27, we want to avoid having the leading edge of the

receiver’s window (i.e., the one with the “highest” sequence number) wrap around in the sequence

number space and overlap with the trailing edge (the one with the ”lowest” sequence number

in the sender’s window). That is, the sequence number space must be large enough to fit the

entire receiver window and the entire sender window without this overlap condition. So – we

need to determine how large a range of sequence numbers can be covered at any given time by

the receiver and sender windows.

Suppose that the lowest-sequence number that the receiver is waiting for is packet m. In this

case, it’s window is [m,m+w-1] and it has received (and ACKed) packet m-1 and the w-1 packets

before that, where w is the size of the window. If none of those w ACKs have been yet received

by the sender, then ACK messages with values of [m-w,m-1] may still be propagating back. If

no ACKs with these ACK numbers have been received by the sender, then the sender’s window

would be [m-w,m-1].

Thus, the lower edge of the sender’s window is m-w, and the leading edge of the receivers window

is m+w-1. In order for the leading edge of the receiver’s window to not overlap with the trailing

edge of the sender’s window, the sequence number space must thus be big enough to accommodate

2w sequence numbers. That is, the sequence number space must be at least twice as large as the

window size, k ≥ 2w

Problem 22

Answer true or false to the following questions and briefly justify your answer:

(a) With the SR protocol, it is possible for the sender to receive an ACK for a packet that falls outside of

its current window.

(b) With GBN, it is possible to for the sender to receive an ACK for a packet that falls outside of its current

window.

(c) The alternating-bit protocol is same as the SR protocol with a sender and receiver window size of 1.

(d) The alternating-bit protocol is the same as the GBN protocol with a sender and receiver window size of

1.

Answer

(a) True. Suppose the sender has a window size of 3 and sends packets 1, 2, 3 at t0. At t1(t1 > t0)

the receiver ACKS 1, 2, 3. At t2(t2 > t1) the sender times out and resends 1, 2, 3. At t3 the

receiver receives the duplicates and re-acknowledges 1, 2, 3. At t4the sender receives the ACKs

that the receiver sent at t1 and advances its window to 4, 5, 6. At t5 the sender receives the

ACKs 1, 2, 3 the receiver sent at t2. These ACKs are outside its window.

(b) True. By essentially the same scenario as in (a).

(c) True.

Problem 24 continued on next page. . . Page 6 of 18

Page 7: 28_hw5-sol

Handout # 28 EE 471/ CS 471 /CS 573: Fall 2011-2012 Due on Dec 13th, 2011

Problem 24

Consider sending a enormous file of L bytes from Host A to Host B. Assume an MSS of 536 bytes.

(a) What is the maximum value of L such that TCP sequence numbers are not exhausted? Recall that the

TCP sequence number field has 4 bytes.

(b) For the L you obtain in (a), find how long it takes to transmit the file. Assume that a total of 66 bytes

transport, network, and data-link header are added to each segment before the resulting packet is sent out

over a 155 Mbps link. Ignore flow control and congestion control so A can pump out the segments back to

back and continuously.

Answer

There are 232 = 4, 294, 967, 296 possible sequence numbers.

(a) The sequence number does not increment by one with each segment. Rather, it increments

by the number of bytes of data sent. So the size of the MSS is irrelevant – the maximum size file

that can be sent from A to B is simply the number of bytes representable by 232 = 4.19 Gbytes.

(b) The number of segments is 232

536= 8, 012, 999. When 66 bytes of header get added to each

segment, we have a total of 8,012,999 × 66 = 528,857,934 bytes of header. The total number of

bytes transmitted is 232 + 528, 857, 934 = 4.824 × 109 bytes. Thus it would take 249 seconds to

transmit the file over a 155 Mbps link.

Problem 26

Host A and B are directly connected with a 100 Mbps link. There is one TCP connection between the two

hosts, and Host A is sending to Host B an enormous file over this connection. Host A can send its application

data into its TCP socket at a rate as high as 120 Mbps but Host B can read out of its TCP receive buffer

at a maximum rate of 60 Mbps. Describe the affect of TCP flow control.

Answer

Since the link capacity is only 100 Mbps, so host As sending rate can be at most 100Mbps. Still,

host A sends data into the receive buffer faster than Host B can remove data from the buffer.

The receive buffer fills up at a rate of roughly 40Mbps. When the buffer is full, Host B signals

to Host A to stop sending data by setting RcvWindow = 0. Host A then stops sending until it

receives a TCP segment with RcvWindow>0. Host A will thus repeatedly stop and start sending

as a function of the RcvWindow values it receives from Host B. On average, the long-term rate

at which Host A sends data to Host B as part of this connection is no more than 60Mbps.

Problem 34

Compare GBN, SR and TCP (no delayed ACK). Assume that the timeout values for all three protocols are

sufficiently long such that 5 consecutive data segments and their corresponding ACKs can be received (if not

lost in the channel) by the receiving host (Host B) and the sending host (Host A) respectively. Suppose Host

A sends 5 data segments to Host B, and the 2nd segment (sent from A) is lost. In the end, all 5 segments

have been correctly received by Host B.

Problem 34 continued on next page. . . Page 7 of 18

Page 8: 28_hw5-sol

Handout # 28 EE 471/ CS 471 /CS 573: Fall 2011-2012 Due on Dec 13th, 2011

(a) How many segments has Host A sent in total and how many ACKs has Host B sent in total? What are

their sequence numbers? Answer this question for all three protocols.

(b) If the timeout values for all three protocols are much longer than 5 RTT, then which protocol successfully

delivers all five data segments in shortest time interval?

Answer

(a) GoBackN:

A sends 9 segments in total. They are initially sent segments 1, 2, 3, 4, 5 and later re-sent

segments 2, 3, 4, and 5. B sends 8 ACKs. They are 4 ACKS with sequence number 1, and 4

ACKS with sequence numbers 2, 3, 4, and 5.

Selective Repeat:

A sends 6 segments in total. They are initially sent segments 1, 2, 3, 4, 5 and later re-sent

segments 2. B sends 5 ACKs. They are 4 ACKS with sequence number 1, 3, 4, 5. And there is

one ACK with sequence number 2.

TCP:

A sends 6 segments in total. They are initially sent segments 1, 2, 3, 4, 5 and later re-sent

segments 2. B sends 5 ACKs. They are 4 ACKS with sequence number 2. There is one ACK

with sequence numbers 6. Note that TCP always send an ACK with expected sequence number.

(b) TCP. This is because TCP uses fast retransmit without waiting until time out.

Question 1

Consider two hosts A and B that have data to be exchanged using TCP. In this problem, we will assume that

the propagation delay between the two hosts is one time slot equal to the transmission of a packet (assumed

of constant size), and the hosts never have urgent data to be transmitted. No data in a packet can be used

prior to the complete reception of that packet. The maximum data field in a packet is 200 bytes. Assume

that Host A has a buffer to receive data from the other host of size 800 bytes, and Host B has a buffer to

receive data from Host A of size 400 bytes. Further assume that the time to transfer the data to the higher

layer once a packet is received is negligible. No errors ever occur in transmission. Hosts use maximum size

packets whenever possible. Host A has 900 bytes to send to Host B, and Host B has 1300 bytes to send to

Host A. Consider that Host A initiates the opening of a connection, which is accepted by Host B. Host A

starts with sequence number equal to 428 and declares a TCP window size equal to 800, and Host B wants

to start with sequence number 374 and declares a TCP window size equal to 400. Both window sizes remain

unchanged for the entire duration of the session. If a station is blocked because of the window declaration, it

does not send an empty data unit just to acknowledge received data. The table on the next page shows only

the relevant parts of the TCP header. Fill in the fields showing the sequence of TCP data units exchanged

in opening the connection, in the data transfer phase, and in closing the connection. Consider that a host

closes its side of the connection as soon as it finishes the transmission of its data, and following the close, it

continuously acknowledges data received from the other side. If a field is not used, leave it blank.

Page 8 of 18

Page 9: 28_hw5-sol

Handout # 28 EE 471/ CS 471 /CS 573: Fall 2011-2012 Due on Dec 13th, 2011

Answer

See interaction of hosts in the following table.

SEQ# ACK# WINDOW SYN FIN ACK

HOST A (900 bytes to send)

SEQ#ACK#WINDOWSYNFINACK

HOST B (1300 bytes to send)

428 800 1 0 0

1 10 400 429 374

429 800 0 0 1375

629 800 0 0 1375

1 00 400 629 375

1 00 400 829 575

1 00 400 829 775

1 00 400 829 975

829 800 0 0 1575

1029 800 0 0 1775

1 00 400 1029 1175

1 00 400 1229 1375

1229 800 0 0 11375

1329 800 0 0 11575

1 00 400 1329 1575

1 01 400 1330 1675

1330 800 0 0 11675

1330 800 0 0 11676

connection deleted

timed wait before deletion

Question 2 continued on next page. . . Page 9 of 18

Page 10: 28_hw5-sol

Handout # 28 EE 471/ CS 471 /CS 573: Fall 2011-2012 Due on Dec 13th, 2011

Question 2

Consider two stations A and B directly connected over an unreliable physical channel. Our goal is to provide

a reliable channel at the data link layer between these two stations. Time is slotted with the slot size taken

to be the unit of time. The 1-way propagation delay is d slots, where d is assumed to be an integer. All

frames are of equal size, and the transmission time of a frame is exactly one slot. We are interested in the

transmission of frames from A to B. We assume that the processing delay at station B is negligible, and that

acknowledgments for frames transmitted by A are sent from B at the earliest possible time. Since the frames

are of equal size, and d is an integer, we can consider the time axis to be slotted with the slot size equal to

a frame transmission time, and the two stations A and B to be synchronized.

(a) Assume an environment where no transmission errors can occur in either direction. Find the minimum

values for the sending window size Ws, the receive window size Wr, and the sequence range (starting at 0)

which achieve maximum efficiency.

For the rest of the question, consider an environment where noise occurs in bursts on an infrequent

basis; however each noise occurrence causes a certain number of consecutive packets k ≥ 1 to be received

in error. In this problem, we assume that errors occur in packet transmissions from A to B only, and thus

acknowledgement packets from B are always received by A correctly. We consider the use of the Go-Back-N

(GBN) mechanism and the selective repeat (SR) mechanism for error recovery, and we are interested in the

efficiency of these mechanisms in the environment described. We further assume that:

i) the time-out at the sender is very large, and should not be counted on for recovery; i.e., the only way

to detect frames received in error is by receiving a frame out-of-order.

ii) the time that separates noise occurrences is large compared to the time it takes to recover from errors.

(b) Consider the case where the GBN mechanism is used. Give as a function of k the minimum values

of Ws and Wr that minimize the number of wasted slots (i.e., idle slots, erroneous transmissions, and

retransmissions), as compared to the ideal case of part (a) where no errors occur.

(c) Consider the case where only the SR mechanism is used. Give as a function of k the minimum values

of Ws and Wr that minimize the number of wasted slots (i.e., idle slots, erroneous transmissions, and

retransmissions).

(d) Which of the two mechanisms gives the best performance (i.e., minimum number of wasted slots) as a

function of k (assuming their respective optimal window sizes are used.)

Answer

(a) The send window should be large enough to keep the sender busy until the first frame is

acknowledged, i.e., Ws = 2d + 2. Receive window can be as small as possible because frames

never arrive out of order, i.e., Wr = 1. The sequence range should be 0, 1, . . . , 2d+ 1.

(b) With GBN, there is no need to make receive window any larger than what it is in part (a),

because out of order frames will not be entertained by the receiver anyways. Thus, Wr = 1 is

the minimum receive window. The send window also does not need to be changed from part (a)

except that after sending k erroneous frames, the sender must be able to send one correct frame.

Page 10 of 18

Page 11: 28_hw5-sol

Handout # 28 EE 471/ CS 471 /CS 573: Fall 2011-2012 Due on Dec 13th, 2011

This is because the recovery can only start when a duplicate ACK (or NACK) is received by the

sender, which will be sent by the receiver only after receiving a correct but unexpected frame.

Thus, Ws = max{2d+ 2, k + 1}.

(c) With SR, consider the first erroneous frame from the sender. This streak of erroneous frames

continues for k consecutive frames, as given in the problem statement. The sender finds out

about the first erroneous frame k+2d+2 slots later, when it receives an ACK from the receiver

asking for a retransmit of the first erroneous frame. Similarly, error in the k − th frame is

detected at k + k(2d + 2). The ACK that completes the error recovery arrives at the sender at

k+(k+1)(2d+2). At this point, k frames were sent twice and k− 1 frames were acknowledged.

Hence,

Ws = (2d+ 2)(k + 1) + k − k − (k − 1) (1)

= (2d+ 2)(k + 1)− k + 1 (2)

The maximum number of out of order frames at the receiver is just before the k − th erroneous

frame is received for the second time (this time, correctly, as per problem statement). This

maximum number of out of order frames dictates the receive window size. Note that frame k is

sent for the second time at slot k + k(2d + 2) + 1. At this time, k frames were sent twice and

k − 1 were received in order and removed from the window. Thus,

Wr = k(2d+ 2) + k + 1− k − (k − 1) (3)

= k(2d+ 2)− k + 2 (4)

(d) When optimal window sizes are used, the number of wasted slots in SR is k. Using GBN, the

number of wasted slots is k + 2d + 2. Thus, SR is always better than GBN in terms of number

of wasted slots.

Question 3: (Fragmentation and Reassembly)

Consider a series of networks (or subnets) connected by routers as shown in the figure. When an IP packet

is forwarded onto a network whose MTU is smaller, the packet needs to be fragmented. Host A wants to

send two IP packets to host B; the ID and LEN of the of the packets are:

i) Packet 1: ID=412, LEN=400

ii) Packet 2: ID=413, LEN=700

Assume that IP headers are 20 bytes long (i.e., no options).

(a) Fill in the tables depicting how packets flow on each network, using one row for each IP packet or a

fragment. Fill in all fields including ID, OFFSET, M (where M is the “more fragments?” bit which is set to

0 if there are no more fragments to follow).

(b) Why is there an MTU for a given network? One line!

(c) What does the MTU of a network might depend on? One line!

Page 11 of 18

Page 12: 28_hw5-sol

Handout # 28 EE 471/ CS 471 /CS 573: Fall 2011-2012 Due on Dec 13th, 2011

A BSubnet X Subnet Y Subnet ZR1 R2

Router Router

MTU=300 MTU=1000 MTU=200

Subnet X: A → R1

ID M OFFSETSubnet Y: R1 → R2

ID M OFFSETSubnet Z: R2 → B

ID M OFFSET

Answer

(a)

Subnet X: A → R1

ID M OFFSET412 1 0412 0 35413 1 0413 1 35413 0 70

Subnet Y: R1 → R2

ID M OFFSET412 1 0412 0 35413 1 0413 1 35413 0 70

Subnet Z: R2 → B

ID M OFFSET412 1 0412 1 22412 0 35413 1 0413 1 22413 1 35413 1 57413 0 70

(b) To keep the packet error rates within/below a desirable level.

(c) Bit error rate and target packet error rate.

Review Question 27

Why are different inter-AS and intra-AS protocols used in the Internet?

Answer

Intra-AS protocols have been designed by keeping in mind the performance parameters within

the AS but the inter-AS protocol aim to advertise the subnets based on the policy of the AS.

Review Question 30

How does BGP use the NEXT-HOP attribute? How does it use the AS-PATH attribute?

Page 12 of 18

Page 13: 28_hw5-sol

Handout # 28 EE 471/ CS 471 /CS 573: Fall 2011-2012 Due on Dec 13th, 2011

Answer

Routers use the AS-PATH attribute to detect and prevent looping advertisements; they also use it

in choosing among multiple paths to the same prefix. The NEXT-HOP attribute indicates the IP

address of the first router along an advertised path (outside of the AS receiving the advertisement)

to a given prefix. When configuring its forwarding table, a router uses the NEXT-HOP attribute.

Problem 18

Suppose datagrams are limited to 1,500 bytes (including header) between source Host A and destination

Host B. Assuming a 20-byte IP header, how many datagrams would be required to send and MP3 consisting

of 5 million bytes? Explain how you computed your answer.

Answer

Assume the data is carried in TCP segments, with each TCP segment also having 20 bytes of

header. Then each datagram can carry 1500-40=1460 bytes of the MP3 file.

Number of datagrams required =

5× 106

1460

= 3425

All but the last datagram will be 1,500 bytes; the last datagram will be 960+40 = 1000 bytes.

Note that here there is not fragmentation – the source host does not create datagrams larger

than 1500 bytes, and these datagrams are smaller than the MTUs of the links.

Problem 20

Suppose you are interested in detecting the number of hosts behind a NAT. You observe that the IP layer

stamps an identification number sequentially on each IP packet. The identification number of first packet

generated by a host is random number, and the identification numbers of the subsequent IP packets are

sequentially assigned. Assume all packets generated by hosts behind NAT are sent to the outside world.

(a) Based on this observation, and assuming you can sniff all packets sent by the NAT to the outside, can

you outline a simple technique that detects the number of unique hosts behind a NAT? Justify your answer.

(b) If the identification numbers are not sequentially assigned but randomly assigned, would your technique

work? Justify your answer.

Answer

(a) Since all IP packets are sent outside, so we can use a packet sniffer to record all IP packets

generated by the hosts behind a NAT. As each host generates a sequence of IP packets with

sequential numbers and a distinct (very likely, as they are randomly chosen from a large space)

initial identification number (ID), we can group IP packets with consecutive IDs into a cluster.

The number of clusters is the number of hosts behind the NAT.

(b) However, if those identification numbers are not sequentially assigned but randomly assigned,

the technique suggested in part (a) won’t work, as there won’t be clusters in sniffed data.

Problem 21 continued on next page. . . Page 13 of 18

Page 14: 28_hw5-sol

Handout # 28 EE 471/ CS 471 /CS 573: Fall 2011-2012 Due on Dec 13th, 2011

Problem 21

In this problem we’ll explore the impact of NATs on P2P applications. Suppose a peer with username

Arnold discovers through querying that a peer with username Bernard has a file it wants to download. Also

suppose that Bernard and Arnold are both behind a NAT. Try to devise a technique that will allow Arnold

to establish a TCP connection with Bernard without application specific NAT configuration. If you have

difficulty devising such a technique, discuss why.

Answer

It is not possible to devise such a technique. In order to establish a direct TCP connection

between Arnold and Bernard, either Arnold or Bob must initiate a connection to the other. But

the NATs covering Arnold and Bob drop SYN packets arriving from the WAN side. Thus neither

Arnold nor Bob can initiate a TCP connection to the other if they are both behind NATs.

Problem 24

Consider the following network. With the indicated link costs, use Dijkstra’s shortest-path algorithm to

compute the shortest path from x to all network nodes. Show how the algorithm works by computing a

table similar to table 4.3.

Figure 3: Figure and table referred in Problem 24 of Chapter 4

Page 14 of 18

Page 15: 28_hw5-sol

Handout # 28 EE 471/ CS 471 /CS 573: Fall 2011-2012 Due on Dec 13th, 2011

Answer

Step N’ D(t),p(t) D(u),p(u) D(v),p(v) D(w),p(w) D(y),p(y) D(z),p(z)

0 x ∞ ∞ 3,x 6,x 6,x 8,x

1 xv 7,v 6,v 3,x 6,x 6,x 8,x

2 xvu 7,v 6,v 3,x 6,x 6,x 8,x

3 xvuw 7,v 6,v 3,x 6,x 6,x 8,x

4 xvuwy 7,v 6,v 3,x 6,x 6,x 8,x

5 xvuwyt 7,v 6,v 3,x 6,x 6,x 8,x

6 xvuwytz 7,v 6,v 3,x 6,x 6,x 8,x

Problem 26

Consider the network shown below, and assume that each node initially knows the cost to each of its

neighbours. Consider the distance-vector algorithm and show the distance table entries at node z.

Figure 4: Figure referred in Problem 26 of Chapter 4

Answer

Cost to

From

u v x y z

v ∞ ∞ ∞ ∞ ∞

x ∞ ∞ ∞ ∞ ∞

z ∞ 6 2 ∞ 0

Cost to

From

u v x y z

v 1 0 3 ∞ 6

x ∞ 3 0 3 2

z 7 5 2 5 0

Cost to

From

u v x y z

v 1 0 3 3 5

x 4 3 0 3 2

z 6 5 2 5 0

Cost to

From

u v x y z

v 1 0 3 3 5

x 4 3 0 3 2

z 6 5 2 5 0

Problem 31

Argue that for the distance-vector algorithm in Fig. 4.30, each value in the distance vector D(x) is non-

increasing and will eventually stabilize in a finite number of steps.

Page 15 of 18

Page 16: 28_hw5-sol

Handout # 28 EE 471/ CS 471 /CS 573: Fall 2011-2012 Due on Dec 13th, 2011

Figure 5: Figure 4.31 referred in Problem 31 of Chapter 4

Answer

At each step, each updating of a node’s distance vectors is based on the Bellman-Ford equation,

i.e., only decreasing those values in its distance vector. There is no increasing in values. If no

updating, then no message will be sent out. Thus, D(x) is non-increasing. Since those costs are

finite, then eventually distance vectors will be stabilized in finite steps.

Problem 34

Will a BGP router always choose the loop-free route with shortest AS-path length? Justify your answer.

Answer

The chosen path is not necessarily the shortest AS-path. Recall that there are many issues to be

considered in the route selection process. It is very likely that a longer loop-free path is preferred

over a shorter loop-free path due to economic reason. For example, an AS might prefer to send

Page 16 of 18

Page 17: 28_hw5-sol

Handout # 28 EE 471/ CS 471 /CS 573: Fall 2011-2012 Due on Dec 13th, 2011

traffic to one neighbour instead of another neighbour with shorter AS distance.

Problem 35

Consider the network shown below. Suppose that AS3 and AS2 are running OSPF for their intra-AS routing

protocol. Suppose AS1 and AS4 are running RIP for their intra-AS routing protocol. Suppose eBGP and

iBGP are used for the inter-AS routing protocol. Initially suppose there is no physical link between AS2

and AS4.

(a) Router 3c learns about prefix x from which routing protocol: OSPF, RIP, eBGP, or iBGP?

(b) Router 3a learns about prefix x from which routing protocol?

(c) Router 1c learns about prefix x from which routing protocol?

(d) Router 1d learns about prefix x from which routing protocol?

Figure 6: Figure referred in Problem 35 & 36 of Chapter 4

Answer

(a) eBGP

(b) iBGP

(c) eBGP

(d) iBGP

Problem 36

Referring to the previous problem, once router 1d learns about x it will put an entry (x, I) in its forwarding

table.

(a) Will I be equal to I1 or I2 for this entry? Explain why in one sentence.

(b) Now suppose that there is a physical link between AS2 and AS4, shown by the dotted line. Suppose

router 1d learns that x is accessible via AS2 as well as vis AS3. Will I be set toI1 or I2? Explain why in

one sentence.

Problem 36 continued on next page. . . Page 17 of 18

Page 18: 28_hw5-sol

Handout # 28 EE 471/ CS 471 /CS 573: Fall 2011-2012 Due on Dec 13th, 2011

(c) Now suppose there is another AS, called AS5, which lies on the path between AS2 and AS4 (not shown

in diagram). Suppose router 1d learns that x is accessible via AS2 AS5 AS4 as well as via AS3 AS4. Will I

be set toI1 or I2? Explain why in one sentence.

Answer

(a) I1, because this interface begins the least cost path from 1d towards the gateway router 1c.

(b) I2. Both routes have equal AS-PATH length but I2 begins the path that has the closest

NEXT-HOP router.

(c) I1. I1 begins the path that has the shortest AS-PATH.

Figure 7: Figure 4.31 referred in Problem 37 of Chapter 4

Problem 37

Consider the following network. ISP B provides national backbone service to regional ISP A. ISP C provides

national backbone service to ISP D. Each ISP consists of one AS. B and C peer with each other in two places

using BGP. Consider traffic going from A to D. B would prefer to hand that traffic over to C on the West

Coast (so that C would have to absorb the cost of carrying the traffic cross-country), while C would prefer

to get the traffic via its East Coast peering point with B (so that B would have carried traffic across the

country). What BGP mechanism might C use, so that B would hand over A-to-D traffic at its East Coast

peering point? To answer this question you will need to dig into the BGP specification.

Answer

One way for C to force B to hand over all of Bs traffic to D on the east coast is for C to only

advertise its route to D via its east coast peering point with C.

Page 18 of 18