16
1 Homework Assignment #2 [SP1] Due 10/4 at 5:00pm EE122 Fall 2012 Please submit your solutions using BSpace (https://bspace.berkeley.edu/). Log in to BSpace with your CalNet ID, click on the EL ENG 122 Fa12 tab, and click on Assignments under Course Tools. Your assignment should be submitted as hw2.txt, using the format described on the class web page (http://www- inst.eecs.berkeley.edu/~ee122/fa12/homework/hw2). The multiple choice answers will be graded automatically, but please show your work so we can check your reasoning. This work can be included in the hw2.txt file, or in a separate hw2work.txt or hw2work.pdf file. Assignments with only answers and no shown work will receive no credit. Improperly formatted assignments will receive no credit. Each question is worth a single point, and the total assignment is worth 20 points. Layers [5 points] Networking is undergoing a new boom, with many new inventions being pursued by ingenious researchers. Here are some of the highlights: 1) TedNet: This technology, invented by Ted Stevens, allows devices to exchange packets over a building’s plumbing infrastructure. Finally, a network that’s really made out of tubes! d/e “exchange packets” is Data-Link, but our original wording “allows devices to communicate” could be argued to be Physical, so we accept both answers (notwithstanding that there’s “one for each layer”). 2) OverFlowControl: Soon after TedNet was invented, users began flooding their houses because they were sending too many packets. This protocol helps limit the rate at which packets are sent. b 3) Fortuna Routing Protocol (FRP): this protocol calculates routes between hosts worldwide, while avoiding path lengths that are unlucky numbers. c 4) IOUTube: a video sharing site, where viewers agree in principle to pay the content producer someday (right after they pay off their student loans). a 5) Neutrino-Net: motivated by the increasing degree of censorship in the Internet, this technology uses neutrinos to deliver data. Since neutrinos are so hard to detect, government censors will have a hard time preventing transmission. e For each of the above, list which layer they belong to in the Internet architecture: (hint: there is one for each layer) (a) Application (b) Transport (c) Networking (d) Data-Link (e) Physical

Homework Assignment #2 [SP1] Due 10/4 at 5:00pmee122/fa12/homework/hw2/answers2.pdf · 1 Homework Assignment #2 [SP1] Due 10/4 at 5:00pm EE122 Fall 2012 Please submit your solutions

  • Upload
    leminh

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

1

Homework Assignment #2 [SP1]

Due 10/4 at 5:00pm

EE122 Fall 2012

Please submit your solutions using BSpace (https://bspace.berkeley.edu/). Log in to BSpace with your CalNet ID, click on the EL ENG 122 Fa12 tab, and click on Assignments under Course Tools. Your assignment should be submitted as hw2.txt, using the format

described on the class web page (http://www-inst.eecs.berkeley.edu/~ee122/fa12/homework/hw2). The multiple choice answers will be graded automatically, but please show your work so we can check your reasoning. This work can be included in the hw2.txt file, or in a separate hw2work.txt or hw2work.pdf file.

Assignments with only answers and no shown work will receive no credit.

Improperly formatted assignments will receive no credit.

Each question is worth a single point, and the total assignment is worth 20 points.

Layers [5 points]

Networking is undergoing a new boom, with many new inventions being pursued by ingenious

researchers. Here are some of the highlights:

1) TedNet: This technology, invented by Ted Stevens, allows devices to exchange packets

over a building’s plumbing infrastructure. Finally, a network that’s really made out of

tubes! d/e

“exchange packets” is Data-Link, but our original wording “allows devices to

communicate” could be argued to be Physical, so we accept both answers

(notwithstanding that there’s “one for each layer”).

2) OverFlowControl: Soon after TedNet was invented, users began flooding their houses

because they were sending too many packets. This protocol helps limit the rate at which

packets are sent. b

3) Fortuna Routing Protocol (FRP): this protocol calculates routes between hosts

worldwide, while avoiding path lengths that are unlucky numbers. c

4) IOUTube: a video sharing site, where viewers agree in principle to pay the content

producer someday (right after they pay off their student loans). a

5) Neutrino-Net: motivated by the increasing degree of censorship in the Internet, this

technology uses neutrinos to deliver data. Since neutrinos are so hard to detect,

government censors will have a hard time preventing transmission. e

For each of the above, list which layer they belong to in the Internet architecture: (hint: there is

one for each layer)

(a) Application (b) Transport (c) Networking (d) Data-Link (e) Physical

2

Routing Validity [1 point]

6) List which (if any) of the following claims about routing state “validity”1 are correct

(e.g., if you think only statements b and d are correct, then simply list bd as your answer).

In the following, assume the link costs are defined according to a reasonable metric. bc

a. Global routing state is valid if and only if there are no loops

Incorrect – this ignores dead ends

b. Global routing state is valid if, for any source and destination nodes, the packet is

always received by the destination node, and always via the least-cost path

Correct – “always received by the destination node” implies absence of dead

ends, and “always via the least-cost path” implies no loops. Note that “only if”

would be incorrect.

c. Global routing state is valid only if there are no dead ends

Correct: valid → no dead ends. Note that “if” would be incorrect.

This assumes the clarification on Piazza that a destination is not a “dead-end”.

d. Global routing state is valid only if all nodes have the same global view of the

network (assuming link-state routing)

Incorrect – sometimes their different view of the network still leads to correct

routing decisions. Q20 is an example of this!

Transport Algorithms [1 point]

7) List which (if any) of the following transport protocols are “reliable” as defined in lecture

6. Use the same format as your answer to question 6.

Assume all packets come with sequence numbers X, and there is no corruption. bc

These can be answered by considering the questions:

What happens if packet X is lost, and:

o a packet X+i is received?

o no further packets are received? (either because the sender has run out of packets,

or the later packets were also lost)

What happens if ACK X is lost, and:

o a packet X+i is received?

o no further packets are received?

Protocol Sender Receiver

a Send packets in order

Resend packet X only when it

receives a NACK for X.

When packet X arrives:

o If the previous packet was X-

1, do nothing

o If the previous packet was Y

≠ X-1, then send a NACK for

1 Terminology as defined in the routing lectures.

3

Y+1

Not reliable. Counter-examples:

Packets 1 to 10 are sent, but packet 10 is lost: no NACK is generated unless

packet 11 is received.

Packets 1 to 10 are sent, packet 9 is lost, and a NACK is generated for packet

9 but lost: the sender will not know to resend packet 9, nor will the receiver

resend the NACK. (When packet 11 is received, the receiver will consider it

in order.)

b Send packets in order

When packet X is sent (or

resent):

o set timer for X

o cancel timer when

ACK for X arrives

o resend X when timer

expires (and set new

timer for X)

For each packet X received:

o If this is the first time the

receiver has received X, send

an individual ACK for packet

X.

o If the receiver has seen

packet X before, do nothing

Reliable.

N.B. if the ACK is lost, another packet will be sent (upon time-out) but it will not be

(re-)ACKed, so the sender will keep resending the packet (and maybe no new

packets!). This impacts timeliness and efficiency, not reliability.

c Send packets in a random

order

When packet X is sent (or

resent):

o set timer for X

o cancel timer when

ACK for X arrives

o resend X when timer

expires (and set new

timer for X)

Ignore the first packet to arrive

Whenever a packet arrives, send an

individual ACK acknowledging the

previous packet received. That is, if

packets X then Y arrive, then the

receiver ACKs X.

Reliable.

When a packet X is initially received, it will not be ACKed; however, eventually

another packet will be received (possibly packet X again, due to time out), at which

point packet X will be ACKed.

Similarly, lost ACKs are ok because the sender will time out and resend.

d Send packets in order

Resend packet X+1 whenever

a "duplicate ACK" is received

for packet X

For each packet received, send back

a cumulative ACK

Not reliable. Counter-examples:

Packets 1 to 10 are sent, but packet 10 is lost. No duplicate ACK is generated

4

unless packet 11 is received.

Packets 1 to 10 are sent, packet 9 is lost, but the cumulative ACK generated

for packet 10 (namely, cumulative ACK up to 8) is lost: the sender will not

receive a duplicate ACK.

5

Self-Learning Switch [5 points]

The switches in the following network initially do not know how to reach any other node.

Which switches does the packet visit if:

8) A sends a packet to G. BCEFGH or BCDEFGH

It’s more plausible that G doesn’t forward the packet, but it may have been explained

otherwise.

Next to each node, we’ve written ‘A’ next to the link that would be used to reach ‘A’:

(assuming that G doesn’t forward the packet)

9) G then sends a packet to A. FCA

F, C and A have now learnt which link to use to send to G:

A

C

G

F

D

B

E

H

A

C

G

F

D

B

E

H

A

A

A

A

A

A

6

10) E then sends a packet to A. CA

C and A have now learnt which links to use to send to E:

11) E then sends a packet to G. HCFG

E doesn’t know where G is, so it sends to al its [E’s] neighbors i.e., C and H. C knows where G

is, so it only sends to F (which also knows where G is).

A

C

G

F

D

B

E

H

A

A

A

A

A

A

G

G

G

A

C

G

F

D

B

E

H

A

A

A,

A

A

A

G

G

G,E

E

7

12) Now suppose that C has lost its cache (i.e., it no longer knows how to reach any other

node). H then sends a packet to A. ECAF

Before H sends the packet:

C doesn’t know where A is, so it sends the packet out all ports (except the incoming port),

including to F. F, however, knows that to reach A, it should sent the packet towards C (where it

just received the packet from!), so it drops it.

Specify the labels of switches visited with no extra formatting or punctuation (e.g., ‘8 bcd’); the

order of labels is not important. Do not include the initial sender node in your answer (for

example, ‘G’ should be omitted from the answer in Question 9).

Assume no packet exchanges other than the ones specified in the questions.

A

C

G

F

D

B

E

H

A

A,E

A,E

A,E

A

A

G

G

G,E

E

A

C

G

F

D

B

E

H A,E

A,E

A,E

A

A

G

G,E

8

Distance-Vector Routing [4 points]

The routing table for node B is expressed in a format where the rows indicate the destination and

the columns indicate the first hop. That is, the number in (row C, column D) denotes the cost of

the best currently known path to C that starts with B sending to D. The initial table for node B,

before B has exchanged any routing information with any other node, takes the form:

Table for B A D G

A 5 ∞ ∞

C ∞ ∞ ∞

D ∞ 1 ∞

E ∞ ∞ ∞

F ∞ ∞ ∞

G ∞ ∞ 2

Note that in this initial routing table, B does not know paths to any destinations except its

immediate neighbors.

The following questions will ask you about the routing table. For the auto-graded component of

hw2.txt, you should use “inf” to represent ∞. For example, the row D in the table above is:

inf,1,inf

B D

G

E F

C

A

2

1 1 2

5 5

3

1

1

12

2

16

9

13) After B receives a routing update from A (with A sending its initial table), what are the

entries in row E in the routing table?17,inf,inf

A's initial table includes reachability to D (cost 3), E (cost 12), and F (cost 5).

When it sends its table to B, B can now reach D via A (cost 8 = cost 5 from B to A, plus cost 3

from A to D, which is cheaper than B's existing estimate of ∞). Similarly, B can reach E and F

with costs 5+12 and 5+5 respectively.

Table for B A D G

A 5 ∞ ∞

C ∞ ∞ ∞

D 8 1 ∞

E 17 ∞ ∞

F 10 ∞ ∞

G ∞ ∞ 2

14) After B then receives a routing update from G (with G sending its initial table), what are

the entries in row D in the table? 8,1,3

G's initial table includes reachability to D (cost 1) and C (cost 2).

When it sends its table to B, B can now reach D via G (cost 3 = cost 2 from B to G, plus cost 1

from G to D, which is cheaper than B's existing estimate of ∞). Similarly, B can reach C with

cost 2+2.

Table for B A D G

A 5 ∞ ∞

C ∞ ∞ 4

D 8 1 3

E 17 ∞ ∞

10

F 10 ∞ ∞

G ∞ ∞ 2

15) Assume now that all nodes exchange tables in an iterative process for as many times as it

takes for the tables to settle into a stable state. What is row E in B’s routing table? 9,2,4

Steady-state means all the nodes know the shortest paths to any other node. The shortest paths

from B to E, via first-hop:

A: BADE (cost 5+3+1 = 9)

D: BDE (cost 1+1 = 2)

G: BGDE (cost 2+1+1 = 4)

Table for B A D G

A 5 4 6

C 10 3 4

D 8 1 3

E 9 2 4

F 10 4 6

G 9 2 2

16) Now let’s consider node F. Assume we are at the steady state considered in the previous

problem (but we are focusing on node F’s routing table). Assume that the cost for link A-

F increases to 100, and nodes A and F update their tables to reflect this new local

information. The routers do one full round of exchanges (each router sends its path costs

to its neighbors). At the end of this single round, what is row A in F’s routing table?

100,6,21

The columns are in top-down order of the graph (not alphabetical) i.e.,

Table for F A E C

11

A

At steady state (before the A-F link cost increase), F’s routing table is:

Table for F A E C

A 5 6 21

B 9 4 19

C 10 3 16

D 8 3 18

E 9 2 17

G 9 4 18

F reaches A via E using FEDA (cost 2+1+3), which does not involve link AF.

F reaches A via C using FCEDA (cost 16+1+1+3), which does not involve link AF.

Table for F A E C

A 100 6 21

B D

G

E F

C

A

2

1 1 2

5 100

3

1

1

12

2

16

12

Link-State Routing [4 points]

Consider the network discussed in the previous problem (prior to the cost of link A-F changing

i.e., the cost of A-F is still 5), but now we use a link-state routing algorithm. Assume that all the

nodes have successfully flooded their information to all the other nodes, so all nodes have an

accurate map of the network.

The questions will ask about the path a packet takes; show the path by the series of nodes it

traverses (including the source and destination), such as ABDGCEF. In each case, either show

the path until the packet reaches the destination, or the first twelve hops in case it enters a loop.

Assume that nodes break ties by selecting the first hop node whose label appears earlier in the

alphabet.

17) If B sends a packet to F, what path does the packet take? BDEF

This is the shortest path.

18) Now assume that the link costs for the links D-E and E-F both change to 20. E announces

these changes, and all nodes but D get the updates (that is, D still thinks that D-E and E-F

have cost 1 and 2 respectively; don’t worry why D thinks that, just take it as a fact). B

now sends a packet to F. What path does it take? BDECGDECGDEC

How D sees the network: How everyone else sees the network:

i. B thinks the shortest path (from B to F) is BDAF, so it sends the packet to D

ii. D thinks the shortest path (from D to F) is DEF, so it sends the packet to E

iii. E thinks the shortest path (from E to F) is ECGDAF, so it sends the packet to C

iv. C thinks the shortest path (from C to F) is CGDAF, so it sends the packet to G

v. G thinks the shortest path (from G to F) is GDAF, so it sends the packet to D

vi. D thinks the shortest path (from D to F) is DEF, so it sends the packet to E [this is step ii.,

and the other steps follow]

B D

G

E F

C

A

2

1 1 2

5 5

3

1

1

12

2

16

B D

G

E F

C

A

2

1 1 2

5 5

3

1

20

12

20

16

13

19) Continuing from Question 18: E now resends its flood message, and D finally knows

about the change in link costs. When B sends a packet to F, what path does it take?

BDAF

This is the shortest path.

20) Repeat question 18, but with the link costs changed to 3 for D-E and E-F, with every

node except D receiving the updates. BDEF

i. B thinks the shortest path (from B to F) is BDEF, so it sends the packet to D

ii. D thinks the shortest path (from D to F) is DEF, despite its incorrect understanding of the

costs of D-E and E-F, so it sends the packet to E

iii. E sends the packet on to F

How D sees the network: How everyone else sees the network:

B D

G

E F

C

A

2

1 1 2

5 5

3

1

1

12

2

16

B D

G

E F

C

A

2

1 1 2

5 5

3

1

3

12

3

16

14

Link-State Routing Redux [4 points]

With the original wording “Consider the network discussed in the previous problem”, it was not

clear whether we wanted you to use the network from the start of the Distance-Vector problem

(i.e., the cost of A-F is 5), or at the end (after the cost of A-F is 100). The solution on the

previous pages assumes the former; the solution on the following pages assumes the latter. We

eventually clarified the problem, but so as to not disadvantage those who started early, we will

accept either set of answers.

Consider the network discussed in the previous problem (incorporating the change to the cost of

link A-F i.e., the cost of A-F is 100), but now we use a link-state routing algorithm. Assume that

all the nodes have successfully flooded their information to all the other nodes, so all nodes have

an accurate map of the network.

The questions will ask about the path a packet takes; show the path by the series of nodes it

traverses (including the source and destination), such as ABDGCEF. In each case, either show

the path until the packet reaches the destination, or the first twelve hops in case it enters a loop.

Assume that nodes break ties by selecting the first hop node whose label appears earlier in the

alphabet.

17) If B sends a packet to F, what path does the packet take? BDEF

This is the shortest path.

18) Now assume that the link costs for the links D-E and E-F both change to 20. E announces

these changes, and all nodes but D get the updates (that is, D still thinks that D-E and E-F

have cost 1 and 2 respectively; don’t worry why D thinks that, just take it as a fact). B

now sends a packet to F. What path does it take? BDECF

B D

G

E F

C

A

2

1 1 2

5 100

3

1

1

12

2

16

15

How D sees the network: How everyone else sees the network:

i. B thinks the shortest path (from B to F) is BDGCF, so it sends the packet to D

ii. D thinks the shortest path (from D to F) is DEF, so it sends the packet to E

iii. E thinks the shortest path (from E to F) is ECF, so it sends the packet to C

iv. C thinks the shortest path (from C to F) is CF, so it sends the packet to F

19) Continuing from Question 18: E now resends its flood message, and D finally knows

about the change in link costs. When B sends a packet to F, what path does it take?

BDGCF

This is the shortest path.

20) Repeat question 18, but with the link costs changed to 3 for D-E and E-F, with every

node except D receiving the updates. BDEF

i. B thinks the shortest path (from B to F) is BDEF, so it sends the packet to D

ii. D thinks the shortest path (from D to F) is DEF, despite its incorrect understanding of the

costs of D-E and E-F, so it sends the packet to E

iii. E sends the packet on to F

How D sees the network: How everyone else sees the network:

B D

G

E F

C

A

2

1 1 2

5 100

3

1

1

12

2

16

B D

G

E F

C

A

2

1 1 2

5 100

3

1

20

12

20

16

16

B D

G

E F

C

A

2

1 1 2

5 100

3

1

1

12

2

16

B D

G

E F

C

A

2

1 1 2

5 100

3

1

3

12

3

16