Download as pdf or txt
Download as pdf or txt
You are on page 1of 413

3.

Harry Bovik says that since there are negligible losses within the US, the streaming multimedia applications do
not need to have a playback buffer in US. What would be your response?
Answer: The playback buffer is required to smooth out the video. Delay variance causes packets to arrive after
their playout time and hence are missed. The playback buffer is needed even if there are no losses.

7 Reliability
For all parts of this question, refer to figure 4. The graph shows the packets sent and ACKs received by a TCP Reno
sender. The x-axis shows the time in seconds and the y-axis shows the sequence number of the packet (or ACK) being
sent (or received). Assume that all packets that are not lost will arrive in order at both the sender and receiver. Also
assume that receiver keeps all the out of order received packets.

Sender view of packets and ACKs in TCP Reno


Seqno
Packets
50.0000 ACKs

45.0000

40.0000

35.0000

30.0000

25.0000

20.0000

15.0000

10.0000

5.0000

0.0000
Time
0.0000 1.0000 2.0000 3.0000 4.0000

Figure 4: Reno : Fast Retransmission

1. Mark on the x-axis of the graph, the time interval when the connection is in slow-start.
Answer: Slow start is approximately from time 0 to 1.4sec, 2.2 to 3.1 sec, and 3.5 to 3.7 (though it is fine if you
missed this last one).
2. Mark the packets (if any) with
that are lost.
Answer: Packet Numbers: 25, 26, 27, 29, 32, 36, 41, 46, 47, 48, 49

6
3. Mark the duplicate packets received by the receiver (if any) with a .
Answer: Packet Numbers: 28(2nd), 30(2nd), 31(2nd), 33(2nd), 34(2nd), 35(2nd), 36(3rd), 37(2nd), 38(2nd),
39(2nd), 40(2nd), 41(3rd), 42(2nd), 43(2nd), 44(2nd), 45(2nd), 46(3rd), 50(2nd)

4. Mark the timed out packet (if any) with a T.


Answer: Packet Number: 26
5. Draw on the graph an approximate curve showing how a Tahoe TCP Sender would behave.
Answer: Tahoe will behave the same as Reno for the first 1.5sec. Then while Reno would wait for a timeout,
Tahoe will start slow start around 1.5sec and continue roughly parallel to Reno but being about 1sec earlier
than Reno.

7

   "! # % &'  )(
$
* !+!-,/.01325456798 :(";<:>=%=%: ?@%2A456798B(>;<:>=%=%:C;3
<8D E8

FHGJILKNMOGJP"QSR

T UWVX KNP"YZ[ VX5\V]_^ [a`bQcKZdFHKN[ X KNP"Y

e f>hjilk>mon7pqDr+stkCrumovow7hDx>iNvyn vofzrc{|9}zmorJpCr+q~n€<‚ƒn9xiohD„zrum<w sAr+ioiow…|7r†pCr+hDxz|‡vymw7x>ios5h~vyvyr+„ˆw7q~n9xz| vofzr


g
kw…vof&iofznJx
hDx‰vofzrŠ{|9}zmor7€ˆegfzrŠs5r+ioiow…|7rŠ‹w7iŒiyr+x'v /mn9sLw7xw…k>k%qDhDŽuw…voh~n9x‰m}>x>x>hDx>|n9x&cn9iyvˆ…‘
kCn7movB’7’7’7’vyn$w7xw…kkqDhDŽuw…voh~n9x“m}>x>x>hDx>|ˆn9x&cn9iov ”‘kn7mvB•7•7•7•€@egfzrAvymw7x>iokn7mv‡k>mon7vynŽ–n9qNpCr+hDxz|
}>iyr+„‰hji—e—‚‹˜™€CecfzrŒ{|9}zmorAiofzn-ci†n9xzrkw7Žš7ruvBn7<vof>r5sAr+ioiow…|7r5w…viyru›7rumw7qlkCn9hDx'voi†w7q~n9x>|œhDvoi†kw…vof
 kCn9hDxvoiBžŒ‘Ÿ‘w7x>„¡ ¢€egf>hjik>mon7p%q~r+s_w7iyši £7n9}¤ion9sArˆ¥}zr+iyvohDn9x>i w…pCn9}zv cf>w…vu¦§iiyvyn7mor+„¤w…vvofzr
fzr+w7„zrumigw…vgvofzr+iyrBvofzmorurkCn9hDxvoiu€
¨ vow…movJp£@x}>s pCrumhDxz|vofzrŒfzr+w7„zrumi—hDx©vofzr kw7Žoš7ruv‡w…vJkn9hjx'voicž ‘ŸŒ‘w7x>„“ €egf>w…v—hDiu‘>r+w7Žfªf>r+w7„zrum
iofzn9}qD„pCrAw7ioiohD|9xzr+„“w©x}>s pCrum†/mon9s«Œvyn¬‘bJfzrumor©Ž–n7momor+iykCn9x>„>i—vyn©vofzrAJh~morqDw+£7rum+‘™”Ž–n7mmor–­
iykCn9x>„>i‹vynŠvofzr„>w…vow7qDhDx>šqDw£7rum+‘b®u®u®‘¬5Ž–n7momor+iykCn9x>„>i‹vynŠvofzrBw…k>kqjhDŽuw…voh~n9xœqDw+£7rum€
¯ 7n m@w7qDq—vofzr‰¥}zr+iyvoh~n9xiŠpCr+q~n-‘c£7n9}zm©w7x>io3rum©iofzn9}qD„Evow…š7r‰vof>rª°n7ms±n7 w¡qDhjiyvu€ ¯ 7n m©r–²w7s5kq~r7³
´ kw7Žš7ruvJžŒ‘qDw£7rum—µ9¢‘  kw7Žš7ruvcŸ‘qDw£7rum—”9¢¶9€<ŸNn9}zmcw7x>iyƒrumcs5w£œpr‡vof>rBx}qDqCqDhDiyvu³ ´ 9¶ €

Host X Bridge Y Router Z Host


message message message
H1 B R H2

H1.ip B.mac R.ip H2.ip


H1.mac R.mac H2.mac

…€c·hDiyvgw7qDqCk%qDw7Ž–r+iacfzrumr—”€§h~k$hDiagmhDvyvyr+x"€
´œ ž ‘¸µ9¢‘  ŸŒ‘¸µ9¢‘   ™‘¸µ9¢—¶
”€c·hDiyvgw7qDqCk%qDw7Ž–r+iacfzrumr¹B…€§h~khji‹gmh~vyvyr+x"€
´ ¶
µ€c·hDiyvgw7qDqCk%qDw7Ž–r+iacfzrumrºJ€§sŠw7ŽBhDi‹gmh~vyvyr+x"€
´ ¶
» €c·hDiyvgw7qDqCk%qDw7Ž–r+iacfzrumreJ‚‹˜Ehji‹gmh~vyvyr+x"€
´œ ž ‘¸µ9¢‘  ŸŒ‘%µ9¢‘   ™‘¸µ9¢J¶ e—‚‹˜¼hDiacmh~vyvyr+x©hDxœvofzrBk>mon7vynŽ–n9qC{r+qD„œn7™vofzr½¾˜Efzr+w7„>rum


¬€c·hDiyvgw7qDqCk%qDw7Ž–r+iacfzrumr¹B…€§s5w7Ž hDi‹gmh~vyvyr+xb€
´$ žŒ‘¸”9¢‘  Ÿ‘¸”9¢Œ‘   ™‘¸”9¢B¶ŸNn9}
xzrur+„ªvyn@hDxŽuqD}>„zr   ™‘¸”9¢JpCr+Žuw7}>iyrAh~v—vo}zmx>i—n9}zv†vof>w…v¹ …€§s5w7Ž
mrukqDw7Ž–r+i‡Œ…€§s5w7ŽAw7i†vofzrAiyn9}zmŽ–
r c‚ w7„>„zmr+ioi—cfzr+x$vofzrkw7Žoš7ruvk%w7ioiyr+i†vofzmon9}>|9f$mn9}zvyrum
¹B€
€c·hDiyvgw7qDqCk%qDw7Ž–r+iacfzrumr—”€§s5w7Ž hDi‹gmhDvyvyr+x"€
´  ‘¸”9¢¶

 €c·hDiyvgw7qDqCk%qDw7Ž–r+iacfzrumr‡kn7mvc•7•7•7•5hDi‹gmh~vyvyr+x"€
´ žŒ‘ » ¢‘  ŸŒ‘ » ¢‘   ™‘ » ¢J¶

 n7vyrcvof>w…vƒhDxvof>hDilkmon7pq~r+s ƒrcf>w›7rJiohDs5kqDh {r+„ vofzrcw7„„zmor+ioiNw7iioh~|9x>sAr+xvNp£Aw7ioioh~|9x>hjxz|c‚Ew7x>„


½¾˜)w7„>„zmor+ioior+i<vynmon9}zvyrumiƒw7x„pmhD„z|7r+iƒhDx>iyvyr+w7„n7bvynvofzr+h~mahDxvyrumo w7Ž–r+iu€l½¾xŠmor+w7qjh~v £7‘zw7i‹r–²kqDw7hDxzr+„hDx
vofzrAq~r+Ž–vo}zmrx>n7vyr+iu‘"r+w7Žfmon9}zvyrum‡w7x>„“p>mhj„z|7rBƒn9}>qD„“f>w›7rAv ƒn©½ ˜ w7x„c‚ w7„>„>mor+ioiyr+iu‘Cn9xzr°n7m
r+w7ŽfªhDxvyrumo w7Ž–r7€

”

JrumorBhDiaiof>n7mova/n7mƒw…m„hDxz|vow…pq~r7³


   !" $# %&')(&+*(,".-/ 0"
1224365%375%375 891 :%375%365;365 8
12243<1>=5%365;365 891 :%361 5:%375%375 ?
@ A-/ B) C 892
D m+‘zr+¥}>h~›…w7q~r+xvoq~£³
 !"E'F, G;%(H !" $# %,& 'I(&+*("-/ >0"
: 895 55555 5 8
891 895 55555 5%8895%8 ?
@ -/ BF C 8J2
K f>w…vchDxvyrumo w7Ž–rchDqDqvofzr‡k%w7Žoš7ruvoiJch~vof©vofzr‡°n9qDq~n-chDxz|A„zr+iovohDx>w…voh~n9x©w7„>„>mor+ioiapCr†/n7mƒw…m„>r+„©vynz³

ML
…€B+”7’€¸µ€¸” 9’€¸”7µ
ML
 €¸•
”€B+”7µ€¸µ » €¸” 
ML
µ€B+”7’€¸” 9•€¸•7’€¸•
L
» €B+”7’€¸” » €¸•7’€D+” 
* 0!+Œ-!92

ML ON
…€B+”7’€¸µ€¸” 9’€¸”7µ ˆ½ xvyrumo w7Ž–r  ¹gr+w7ion9x"³<n9x>qD£vofzr†{%miyvgs5w7iyšˆmor+io}q~voiahDx©w5s5w…voŽf%¢€
”€B+”7µ€¸µ » €¸”ML €¸•PN“½¾xvyrumo°w7Ž–r“+¬  ¹gr+w7iyn9xb³  r+h~vof>rum vofzr{miovBxzn7miyr+Ž–n9x>„¤s5w7iyšiBmor+i}>q~v hjxw
sŠw…voŽf%¢€
ML N
µ€B+”7’€¸” 9•€¸•7’€¸• ½¾x'vyrum°w7Ž–rJµ  ¹cr+w7iyn9x"³lºƒn7vofAvofzrƒ{miovw7x„Aiyr+Ž–n9x>„5s5w7iošimor+i}>q~vhDxAs5w…voŽf>r+iu‘
p%}zva3r xzrur+„©vyn5|7n5Jh~vofœvofzrBq~n9x>|7r+iyvak>mor–{>²©s5w…voŽf"€ ¢
L
» €B+”7’€¸” » €¸•7’€D+” QN½ xvyrumo w7Ž–r  ¹cr+w7iyn9x"³ D x>q~£Švof>r†{miyvgs5w7iošmor+i}>q~voiahDx©w5sŠw…voŽf%¢€

µ
LAN #1 LAN #2
A MTU = 1000 R MTU = 500 B

R  U

Jn9iyv  hDian9x@·   
Bw7x>„@Jn9iyvJº hDi‹n9x$·   
”€<egfzr‡v 3nˆ·   iJw…morBhDxvyrumŽ–n9x>x>r+Ž–vyr+„@›hDw5w
mon9}zvyrum€cegfzr ªe 
n7<·   
Bw7x>„$·    L9L9L ML9L
”Šw…mr œw7x>„$¬ ˆp£vyr+iJmor+iykCr+Ž–voh~›7r+qD£7€ ¨ }zk>kCn9iyr
L9L9L
w7x‰w…k>kqjhDŽuw…voh~n9xªn9x‰cn9iov tr–²r+Žu}zvyr+iŠ ©cmh~vyr+i—vyn@w7x‰w…k>kqDhjŽuw…voh~n9xªm}>x>x>hjxz|5n9x
fzn9iov†º "r+w7Žf 


gmhDvyr mor+i}>q~voi—hDxn9x>r ªe c­ ioh ur+„ª½ ˜<› » kw7Žš7ruv‡n9x“·   
…€ <w7Žf“kw7Žoš7ruvŽ–n9xiohDiyvoi—n7<n9xq~£@w7x
 ML
½¾˜Efzr+w7„zrumJw7x>„@„>w…vow5w7x„©vofzr‡½¾˜Efzr+w7„zrum—hDig” Ap£vyr+i xzn5n7k>vohDn9x>i¢€
 }zr+iovoh~n9x"³NJn sŠw7x'£ˆkw7Žoš7ruvoiJ°mon9s Jn9iyv  vynŠJn9iyvcº vymw›7rumiyr ·   
”
ML9L9L D 
* 0!+Œ'2 µ —„w…vow…|7mw7s5in9x·   ”€ x>rƒs5w ²zhDsŒ}>s­ ioh ur  ·   ¢bk%w7Žoš7ruvNŽ–n9x>iohjiyvoin7C” cp£vyr+i ML
ML
f r+w7„zrum†w7x>„“•7’ Šp£vyr+i—„w…vow€Jegfzr vofzmorurŒŽ–n7momor+iykCn9x>„>hjxz|  ·   9” ¢gkw7Žoš7ruvoiw…mrBv ƒnœn7<” Š
z p £vyr+i ML
ML ML
fzr+w7„zrumJw7x>„ » ’ 5p£vyr+ig„>w…vowŠw7x„œn9xzrn7N” Ap£vyr+iJfzr+w7„zrumcw7x>„$” Ap£vyr+ic„w…vow€ ML

  V KlZY

ŸNn9} w…mor$w&kCnn7mˆiy£iyvyr+s w7„s5hDx>hDiovymw…vyn7m+€ N 


Ÿ n9}OŽ–n9}>qD„¼n9xq~£¼w n7m„Evyn¤k}zmŽf>w7iyr$n9xzr7‘gŽuqDw7ioi©‚—‘
xzruv 3n7mošˆx}sBpCrum+€™ŸNn9}œf>w+›7r » xzruv 3n7moši K
‘ žŒ‘ŸŒ‘ ™‘cf>hDŽfw…mr—Ž–n9x>x>r+Ž–vyr+„œp£Šwiohjxz|9q~rcmn9}zvyrum+‘

¹‘>ifzncx@pr+qDn³
<w7Žfxzruv 3n7mšˆmr+¥}>hDmor+i  » ½¾˜Ew7„>„>mor+ioiyr+iu€
ŸNn9}zmy n7pŠhDiNvynB„zr+ioŽ–mhDpr‹vofzra°n7mo‹w…m„>hDx>|—vow…p%q~rgw…vNmon9}zvyrumƒ¹€9enB„zn‡vof>hjiu‘9£7n9}AchjqDqxzrur+„AvynBw7ioi}>sAr
n9xzrk%w…movohDŽu}>qDw…maŽuqDw7iiJ‚ xzruv 3n7moš@x}>s pCrum+€
¨ vow…vyr£7n9}>mJŽf>n9hDŽ–rn7ŽuqDw7ioi—‚ xzruv ƒn7moš©x}sBpCrumgfzrumor7³
ML
* 0!+Œ'2 ” 9¬€¸’7•€  ”ˆhDiaJf>w…va½3k%hDŽoš7r+„"€

»
Network X
Network W 1 2

R
3 4

Network Y Network Z

¯ hDqDqChDx©e™w…pq~rw…v—¹³

* 0!+Œ'2
ªw7iyš ¨ }zpxzruv  }>sBpCrum D }>vy|7n9hDxz|A½¾x'vyrumo w7Ž–r
”7¬7¬€¸”7¬7¬€¸”7¬7¬7¬€D+•7” ML
” 9¬€¸’7•€  ”€D+•7” 
”7¬7¬€¸”7¬7¬€¸”7¬7¬€D+•7” ML
” 9¬€¸’7•€  ”€D+”7’ ”
”7¬7¬€¸”7¬7¬€¸”7¬7¬€D+•7” ML” 9¬€¸’7•€  ”€  » µ
”7¬7¬€¸”7¬7¬€¸”7¬7¬€D+•7” ML ” 9¬€¸’7•€  L
”€ »

  VAV K \V]

¨ }zkkn9ior©vof>w…vvof>rumor$w…mor‰”7”
f>n7kiŠ°mon9s iyn9}zmŽ–r  vyn&„zr+iovohDx>w…voh~n9x ºJ‘ƒp}zv  n7‡vofzrªfzn7kiˆw…mor
vofzmon9}>|9fw7x@½¾˜Ovo}>x>xzr+q €3½  diyruvoicvof>rBegeg·&n7Nw5kw7Žš7ruv†vynˆµ…‘vofzr+x@cfw…vcchDqjqCprBvofzrB›…w7qD}zrn7
vofzrBeceg·‰cfzr+xœvof>rkw7Žoš7ruv—w…momh~›7r+icw…vcº 
* 0!+Œ'2 egfzrŠegec·¼chDqjq™fw+›7rœw©› w7qj}zr €©egfzr5egec·EhDi „zr+Ž–mor+sAr+xvyr+„
p£“ru›7rumo£‰mon9}zvyrum vof>w…v
k monŽ–r+ioiyr+i‹vof>r—½¾˜)fzr+w7„zrum€ Jq~n9x>|Œvof>r‡”7”f>n7kˆk%w…vof"‘vofzrumor‡w…mor”†mon9}zvyrumi‹vofw…v‹Ž–n9}qD„œ„zr+Ž–mor+sAr+xv
>
vofzrBeceg·‰{r+qj„"‘iyn5Jh~vofzn9}zvavofzrBvo}>x>xzr+q ‘zvof>r egeg·3n9}qD„@f>w›7rBpCrur+x$µ¡”t €‹Jnƒru›7rum+‘  L
n7<vof>r+iyrmon9}zvyrumi‡w…mor yhDxiohD„z
r vofzrvo}>x>xzr+q ‘iynœn9x>qD£+¬ˆn7<vofzr+iorŒmn9}zvyrum‡chDqDqf>w+›7r5w7ŽuŽ–r+ii‡vyn©vofzr
r+xv¾­ vyn…­ r+x>„½¾˜Ef>r+w7„zrum+€Negfzreceg·
chjqDqvof>rumoru/n7mrpCrBµ  E+ ¬   €

KlZM GcP"Q GGoYW[ VX  


egfzr  ½ ž)}zvohDqjh~v £!#"%$'&($*)+$—„>hDiykqjw+£i%vof>r<Ž–n9x'vyr+xvoi™n7zŽ–rumovow7hDxxzruv 3n7mš'­ mor+qjw…vyr+„ „>w…vowciyvym}>Ž–vo}zmr+ibhDx
›…w…mh~n9}>i/n7msŠw…voiu€ —xzn7vofzrum}>iyru }>q9}>vohDqDh~v £,*-/.*$*"chDi}>iyr+„Bvyn—s5w7x}>w7qDqD£—s5w7xh~k}>qDw…vyrlvof>r<°n7moƒw…m„>hDxz|

vow…pq~r†n7vofzr‡s5w7Žf>hjxzr7€ Jior01)2!vynAq~r+w…mxœsAn7mor‡w…pCn9}zv‹vofzr+iyr†v ƒn5}zvohDqjh~voh~r+iu‘w7x>„ˆvofzr+x©w7x>iyƒrumavofzr
¥}zr+iyvoh~n9x>i‹pCr+q~n-³

¬
FHK<[ X KNP"Y  VX KNP  VAV K \V]

1 25 .3.8 .1 9 1 2.2 .7.99 1 2.2 .7.13 1 2.2 .7.1 1 25 .3.8 .9 1 25 .3.8 .3 9


MA C 2 MA C 3 MA C 5 MA C 7 MA C 9 MA C 11
1 2.2 .7.34 1 2.2 .7.3 1 25 .3.8 .5
1 25 .3.8 .1 3 1 2.2 .7.56 MA C 6 1 25 .3.8 .8
MA C 4 MA C 8 MA C 10 MA C 12
MA C 1

  
R 1 Hb
Ha R R
R R
Ethernet 2
F ramerelay 2 Ethernets
network

LA N A W AN LA N B
 Ž–n7mkn7mw…voh~n9xœf>w7i‹ƒv n5q~nŽuw7qw…mr+wAxzruƒv n7mošiaŽ–n9x>xzr+Ž–vyr+„©n-›7rumcwŒchD„zr†w…mor+wAxz3ruv n7mošˆ}>iohDx>|Œw7xˆ½¾˜
vo}>x>x>r+q ‘%w7i‡hDi—iofzn-cxªhDxvof>r khjŽ–vo}zmor w…pCn-›7r7€†ecfzr 3v nœr+„z|7rmon9}>vyrumi—vof>w…v—Ž–n9xxzr+Ž–v†vofzrŒ ·  i—vyn
vofzr K   °n7mo‹w…m„“w7x'£@k%w7Žoš7ruvoi‡„zr+iyvohjxzr+„°n7m—vofzr n7vof>rum† ·  vofzmon9}z|9f$vofzrŒvo}>x>xzr+—q€ e}x>xzr+qDhDx>|
hDi }>iyr+„ionvof>w…v vofzrŽ–n7mokCn7mw…vohDn9xŽuw7x¤sAn7morŠr+w7ihDq~£‰}>iyrˆxzn9iyx vow7­ x>„w…m„‰k>mon7vynŽ–n9q3/r+w…vo}zmr+i hDx&h~voi

Ž–n7mokCn7mw…vyr5xzruv 3n7mš%€Aegfzr {miov†·   hDi‡w©iohDs5kq~r <vofzrumxzruv†cfhDq~rŒvofzrAiyr+Ž–n9x>„‰ ·  Ž–n9x>iohDiyvoi†n7
 K
v ƒn <vofzrumxzruvoi<Ž–n9x>xzr+Ž–vyr+„p£w7x5hDxvyrumx>w7qzmn9}zvyrum+€l˜w…movNn7vofzr   m}>xivofzmon9}z|9f5w/mw7s5rumor+qDw+£
xzruv 3n7moš€B½¾xªvofzrŒ{|9}zmor7‘b¹ iyvow7x>„>i—°n7m¹gn9}zvyrumw7x>„“ /n7mJn9iyvu€ ecfzr °mw7sArumr+qDw+£ªiych~voŽfzr+i‡w…mor

xzn7vcifzncx©hjxœvofzrkhDŽ–vo}>mor7‘>w7x>„ Nvof>rumxzruvcf}zpiaw7x>„iych~voŽfzr+igw…morw7qDionŠxzn7vgiofzn-cx"€
K rc‹w7xv<vyn qDnn7šAhDx5s5n7morc„zruvow7hDqw…v<vofzr—fzr+w7„zrumi<n7k%w7Žoš7ruvoiƒpCr+hDxz|‡r–²zŽf>w7xz|7r+„p£w3rupp>monJiyrum
r–²r+Žu}zvohDxz|5n9x@vofzrŽuqDh~r+xvgfzn9iyvc—w5hDx© ·   w7x>„©vofzr‡ƒrupiyrum›7rumJJp@r–²r+Žu}>vohDxz|ŠhDx© ·  º—€
w'¢‡˜3q~r+w7iyrˆiofzn vofzrv £krˆw7x>„
vof>rŠn7m„zrum n7avofzrŠfzr+w7„>rumiBn7avof>rŠkw7Žš7ruvoi pCr+hDx>|©r–²Žf>w7xz|7r+„¤p£
vofzr3rup¤p>mon-ciyrum w7x„iyrumo›7rumŒ°n7mBvofzrƒv nªq~nŽuw…voh~n9x>iŒs5w…moš7r+„n9xvof>rxzru3v n7moš‰k%hDŽ–vo}zmor7€ fzr+x K

iofzn-chDxz|vofzr ¾v £kCr

n7f>r+w7„zrum+‘apCriykCr+Žu{%h Ž  r7€ |z€~‘—n9x"¦ v o}>iyvŠgmh~vyr§vymw7x>iykCn7movu¦~‘‹p}zv5mw…vofzrum
hDx>„hDŽuw…vyr¸eJ‚‹˜g¦n7m  
 †˜g¦~€—n9x"v¦ o}>iyvacmh~vyr¸„>w…vow7qDhDx>š%¦~‘p}zv‹mw…vof>rumghDx>„>hDŽuw…vy¯rm w7sArB¹gr+qjw+£¦~‘>n7m

 Nvof>rumxzruvu¦>n7mcion9sAruvof>hDxz|r+qDior7¢Œ€ ½ xŽuqD}>„zr†w7qDq"fzr+w7„zrumian7vof>r/n9qjq~nchjxz| kmon7vynŽ–n9qqDw+£7rumi+³<xzƒrun7v moš

qDw£7rum+‘w…k>kqjhDŽuw…voh~n9x©qDw£7rum+‘%„>w…vow7qjhDxzšqjw+£7rum+‘w7x>„©vymw7x>iokn7mv‹qjw+£7ruJm+iy€ rBvofzrkw7Žš7ruvcn9}zvoqDhjxzr+igiofzn-cx
pCr+q~nB‘h € r7€{%qDqlhDx
vofzrŠfzr+w7„zrum v£ kCr+i hDx“vof>rŠmh~|9fvpCn+²C€  n7vyrvof>w…vBvofzrumrŠs5w+£‰pCr5sAn7mrŠpCn+²r+i
vof>w7xª£7n9}“xzrur+„"€‡egfzrŒvyn7k“n7Nr+w7Žf
kw7Žoš7ruv‡n9}zvoqjhDxzr Ž–n7mmor+iykCn9x>„>icvynˆvof>r {%miyvcp£vyrhjxvofzrŒkw7Žš7ruv
cf>hjq~rJvof>rpCn7vyvyn9s Ž–n7momor+iokn9x„>i‹vyn5vofzrqDw7iovgp£vyr7€


F ra m e R elay

Ethernet IP (tunnel)
IP IP
TC P TC P
H TTP H TTP

D ata D ata

P acket 1: B -> A P acket 2: A -> B

p¢ ¯ n7m‹vofzrJk%w7Žoš7ruv‹vymw+›7r+qjhDxz|hDxŠ·   º¼/mon9s ·   º)vynA·    ‘hj„zr+x'vohD/£vofzrJk>mhDs5w…m£ {%r+qD„>iNn7


vofzrlk>mn7vynŽ–n9qfzr+w7„zrumiu€™˜Nmhjs5w…mo£g{%r+qD„>iCsAr+w7x>ibion9}zmŽ–r<w7x>„B„zr+iyvohDx>w…vohDn9x†kn7mvCx}>s pCrumiCn7vymw7x>iykCn7mov
k>mon7vynŽ–n9qDiu‘iyn9}zmŽ–rw7x>„
„>r+iyvohDx>w…voh~n9x˜ ½ w7„>„zmr+ioiyr+i°n7m x>ruv ƒn7moš
fzr+w7„zrumi+‘™w7x>„vofzr„w…vow7qDhDxzš“w7„­
„zmor+iiyr+in7mŽ–n9x>xzr+Ž–vohDn9x hD„>r+x'vo%h{ rumib°n7mvof>r3„>w…vow7qDhjxzš‡qDw+£7rum+€legf>rumor3hDixznJx>rur+„BvynJ{%qDq9hjxBw7x£vof>hjxz|c°n7m

w…k>kqjhDŽuw…voh~n9xˆfzr+w7„zrumiu€ —iyr†vofzr†½ ˜)w7x„„>w…vow7qjhDxzš5w7„>„zmr+ioi‹hDxz°n7ms5w…voh~n9xˆiofzn-cxhjxŠvofzr—{|9}>mor7€legfzr
 —¹c·‰vof>w…vcvofzr†p>monJiyrumghDi‹vymo£hDxz|vynAmoruvymhDru›7rhDi 7f'vyvykb³-cg€§hDxvyrumx>w7q €§i}zkCrumŽ–n9s hDx>„>r–²€§fvos5 q€
½ £7n9}$„zn5xzn7vcf>w›7rBr+xzn9}>|9f@hDxz°n7ms5w…voh~n9xœvyniykCr+Žuh~/£œw{r+qj„"‘{%qDqChDx@w7x …ž Šw7x„©p>mh~r%£5r–²k%qDw7hDx"€
½ ™w{%r+qD„©„znr+igxzn7var–²zhDiyvu‘z{%qjqhjx ­ Šw7x>„œr–²kqDw7hDxœpmh~r£7€

H dr Type Src D est

Ethernet M AC 10 M AC 9
IP 125.3.8.8 125.3.8.13
TCP 80 X
HTTP

D ata

’
ML
egfzr—iyn9}zmŽ–r†kCn7movƒhDxŠvof>r—eJ‚a˜¤f>r+w7„zrumahDiƒ’ ‘ziohjx>Ž–rJvofw…vƒhDi3vofzr†„zru w7}>q~vƒkn7mv3}>iyr+„p£ŠJeceg˜  vofzr
w…k>kqjhDŽuw…voh~n9x%¢€legfzr‡„zr+iovohDx>w…voh~n9xˆkCn7movahDia}>xzšxzn-cx"€½ v‹‹w7igw7ioiohD|9xzr+„œp£vofzr‡n7kCrumw…vohDxz|Aiy£iyvyr+sHn7
fzn9iyvg—wAcf>r+x@h~van7kCr+xzr+„œvofzrBŽ–n9xxzr+Ž–voh~n9x©vynvofzriyrumo›7rum+€

Ž¢‹egf>riow7sAr¥}zr+iyvoh~n9x©°n7mgkw7Žš7ruvoicvymw+›7r+qDhDx>|A/mon9s ·    vynŠ·   º vofzmon9}z|9fœvofzrB/mw7s5rumor+qDw+£


xzruv 3n7moš€

H dr Type Src D est

Frame Relay - X
IP (tunnel) 12.2.7.99 12.2.7.3
IP 125.3.8.13 125.3.8.8
TCP X 80
HTTP

D ata

ºƒr+Žuw7}>iyravofzrƒv ƒn‡kw7Žš7ruvoilpCr+q~n9xz|—vyn—vof>rƒiow7s5r‹Ž–n9xxzr+Ž–voh~n9x"‘7vofzr‹½¾˜‰w7x>„ŒeJ‚‹˜‰fzr+w7„zrumi°n7mkw7Žoš7ruvoi


w7x>„$”w…morBiohDsŠhDqDw…m+€egfzr„>h rumor+xŽ–rhDi‹vof>w…vgvofzr iyn9}zmŽ–rw7x>„„zr+iyvohDx>w…vohDn9xˆ{r+qD„>iaw…mor %h~k>kCr+„"€
egfzriyr+Ž–n9x>„
½¾˜ f>r+w7„zrum hDiB/n7mBvofzrŠvo}>xxzr+q €Šegf>rŠiyn9}zmŽ–rw7x>„„zr+iovohDx>w…voh~n9x“½¾˜ w7„„zmor+ioiyr+i w…mor5°n7m
vofzrr+xvymo£œw7x>„©r–²zh~vakCn9hDxvan7vofzrBvo}>x>xzr+q €
‚ƒn9s5sŒ}>x>hjŽuw…voh~n9x@hDxœ°mw7sArmr+qDw+£©hDiap%w7iyr+„@n9x©›h~movo}w7qbŽ–n9x>xzr+Ž–voh~n9xiu€3egfhDiasAr+w7x>icvof>w…vgvofzrB„>r+iyvoh ­
x>w…voh~n9x©{r+qD„œchDqjqf>n9qD„©wAŽ–n9x>xzr+Ž–voh~n9x$hD„zr+xvoh {rum  }>xzšxzn-cx%¢ƒw7x>„©vofw…vgvofzrumorhDicxzn5iyn9}zmŽ–r{r+qD„"€

•
W\ YZ[ V `lKEKN`™ZGJP

½¾x@vof>hDigk>mon7pq~r+s@‘z£7n9}chjqDqCpCrBq~nn7šhDx>|5w…vcvofzr n7krumw…voh~n9x@n7lwŠ„hDiyvow7x>Ž–r›7r+Ž–vyn7m‡w7q~|7n7mh~vof>s hjx©vofzr


Ž–n9xvyr–²vJn7™vof>rxzruv ƒn7moš@hDxœvofzr‡°n9qDq~n-chDxz|Œ{|9}>mor7€
1
R2 1 R3
1 1
1
1
R1 1 1 R4
1
1
1
R6 1 R5

—ioio}>sAr©vofw…vŠw7qDqamon9}>vyrumiApCnn7v5w…vvofzr@iow7sArvohDsAr7‘‹w…vŠvohDsAr@}x>h~v L
€ —ioio}>s5r©vof>w…vŠiyvyrukiw…mor
iy£x>Žf>mon9xzn9}>iu€ ¨ vyruk “Ž–n9x>ihDiyvoiˆn7 „>hjioŽ–n›7rumhjxz|&£7n9}>m@„>hDiyvow7x>Ž–rªvyn)w7qDq—£7n9}zm©xzr+h~|9fpCn7miu€ <w7Žf
io}zp%iyr+¥}>r+x'vƒiyvyruk©Ž–n9x>iohDiyvoi3n7br+w7Žfœmon9}zvyrum‹iyr+x>„>hDx>| w7xˆ}zk"„>w…vyrcvynAw7qDq%h~voi3x>r+h~|9f'pCn7miƒw7x>„mor+Ž–r+h~›hDxz|
wAmon9}>vohDxz|A}zk"„>w…vyr‡°mon9s w7qDq"h~voicxzr+h~|9fpn7miu€
'w ¢ ¨ fzn vofzrˆŽ–n9x'vyr+xvoin7ar+w7Žf¡mon9}>vyrum+¦§iBmn9}zvohDxz|@vow…p%q~rw…vŒvofzrˆr+x>„
n7ciovyruk¡”@p£“{%qjqDhDxz|@hDxvofzr

vow…pq~r+i pCr+q~nB€œecfzrŠmon9}>vohDxz|@vow…pqDrŠ°n7mŒ¹ Šf>w7i pCrur+x‰{%qDqDr+„‰n9}zv w7iŒw7x&r–²w7sAk%q~r7€ <w7Žf&mn9}zvohDxz|
vow…pq~rr+x'vym£Ž–n9x>iohDiovoiBn7cwª„zr+iyvohjx>w…voh~n9xw7„„zmor+ioiu‘lxzr–²vfzn7k&mn9}zvyrumŒw7x„r+iyvohjs5w…vyr+„¡Ž–n9iyv °n7mvofzr
kw…vof©vynŠvof>w…vgmon9}zvyrum€
R1 R2 R3
Dest. Next Hop Metric Dest. Next Hop Metric Dest. Next Hop Metric

R2 R2 1 R1 R1 1 R2 R2 1
R6 R2 2 R6 R6 1 R4 R4 1
R3 R2 2 R3 R3 1 R1 R2 2
R5 R6 2 R5 R4 2
R4 R3 2 R6 R2 2

p¢ƒJn 
s5w7x'£©iyvyruk%ig„znr+igh~vavow…š7rB°n7mgvofzr w7q~|7n7mh~vof>sWvynŽ–n9x'›7rumo|7r ‰˜<q~r+w7iyr‡r–²kqDw7hjx"€
egfzrŒw7q~|7n7mh~vofs chDqjq"Ž–n9x'›7rumo|7rAhDxªµ5iyvyruk%icpCr+Žuw7}>iyr vofzr qDn9xz|7r+iyvJifzn7movyr+iyv—kw…vof$pruv 3rur+xªw7x£@v ƒn
xzn„zr+ighDxœvof>rxzruv ƒn7moš©hDicµAf>n7kiu€
Ž¢½ mon9}zvyrum3¹—µ‡Ž–mw7iof>r+iNw…v<vofzrcr+x>„An7CvohDsArc}x>h~va  w7x>„ŠhDilmorupCnn7vyr+„5w…v<vofzrcr+x>„An7CvohDsArg}>xh~vg+’‘
w…v†vofzrŒr+x>„ªn7Ncf>w…v†vohDsAr}>x>hDvu‘chDqjqh~v†f>w+›7rAwœŽ–n9sAkqDruvyrŒmn9}zvohDxz|vow…pq~r7‘"h € r7€†n9xzrvof>w…v‡Ž–n9x'vow7hjx>i

mon9}zvohjxz|AhDxz°n7ms5w…voh~n9xœn9x@f>n vynŠmor+w7Žf$w7qDqCn7vofzrumcmn9}zvyrumi ˜<q~r+w7iorr–²k%qDw7hDx"€

 L
¹ µŒJhDqDqf>w+›7rBwAŽ–n9s5kq~ruvyr‡mon9}zvohjxz|vow…pq~rw…vavohDsAr5+•ihDx>Ž–r‡h~voigxzr+hD|9f'pCn7mi‹f>w›7rBŽ–n9sAkq~ruvyr‡mn9}zvohDxz|
J
vow…pq~r+icw7x>„@h~vachjqDqvow…š7rn9x>q~£“h~vyrumw…vohDn9x©/n7mJ¹Jµvyn5mr+Ž–r+h~›7rvofzr+iyrBvow…pq~r+iu€
„%¢g½ sŠw…|9hDxzrŒvof>w…vJvof>rx>ruv ƒn7moš$w7„>sŠhDx>hDiyvymw…vyn7mJ„zr+ŽuhD„>r+icvof>w…v‡iof>r ‹w7x'voi†vynœ°n7mo‹w…m„$s5n7mor vymwŽ
w7q~n9xz|Œvofzr—qDhDxzš°mon9s ¹—”vyn¹ €Nen„zn vofw…vu‘ifzrJŽf>w7xz|7r+i‹vofzr†qDhDxzšŽ–n9iyv‹n7bvof>hji<qDhDx>šŒvyn ­ ” €ML K hDqDq

vof>w…vcw7Žf>h~ru›7rŒfzrumghDxvyr+x'v $˜<qDr+w7iyrr–²kqDw7hDx"€
egf>hjigchDqjqxzn7v—3n7mš% € —n9hDx>|ˆw…mon9}x>„vof>rŒq~nn7 k  ”   ¬  » µ ”„zr+Ž–mor+w7ior+i
vofzrŒŽ–n9iyv—s5ruvymhDŽn7lvofhDigkw…vofªw…v—r+w7Žf“h~vyrumw…voh~n9xb€gegfzrBw7q~|7n7mh~vof>s Ž–n9s5k}zvohDxz|vofzr ifzn7movyr+iyvJkw…vof
vyn5r+w7Žf$„zr+iovohDx>w…voh~n9xœchjqDq|7ruvchDxvyn5w7xhDx{x>h~vyr†q~nn7k€

7
 
 "!$# %  '!(*)+ ,-'./ 01#
&
2 #3#3./4506798: <;>=?@$A>BDCC5B EF68: <;>= B$AGBDCCB$AH.I0KJ,/LD#3#

MON?P QSRTNVUGW X YZN?[3\^]>_`NVacb

d e ]HfgQhUGagQS]jikU>Nl]HNFmnNV[

o<prqq5sutwv xrsyrv`t{z}|~xry^€|~wv:s~x&‚„ƒv t|~…Vv †V‡&ˆ qrtS‰H‚„ƒrv`xrv‚Štv`‹u…?vŒx‚h|~xy‚ƒrv qrwsuqD|"


‹|Ž‚suxyrv`‘’|3“ ˆ v‚•”–v`vŒxc‚„ƒrv:‚•”–s—xrs<yvŒtS˜tŠ™ †u†Vˆ š‚{‚…?vŒt`›Soprqrqsutv zœ|~xryg€tv`xry^/„|Ž…Vv`t
|Ž‚ž‚ƒrvZt„|Ž…Vv—‚…?v~Ÿ‚ƒrv/„|Ž…Vv`tž Œsu‘˜‘˜yrv~Ÿ>|Žxry¡‚„ƒrv`x(z¢|~xry*œ £ƒrssutvFyrš¤+v`v`x‚ ¥~|Ž‘prv`tžs~
¦ x§‚„ƒrv&¨©o ‡ zhªu¨¬«­|Ž‘‹usuw˜‚ƒr…&›®zStwtpr…?xr‹ xrs¯s~‚ƒrvŒ°xrsyrvŒt?|~wv|~ `‚˜¥uvŽŸ– Œ|~x*‚ƒrvFv±
‚„|~xrtw…V˜tt˜suxrt:/su…²z¢|~xy(œ Œsu‘˜‘yv³µ´s~ supr qrprwq5sutwvŒt`Ÿ9š‚žtwp¶? ŒvŒtl‚s^”–s~·s~p‚ž‚„ƒv
/su‘˜‘s”nxr‹Zv±¸|~…Vq‘v~›Zo<prqrqsutvVzT|Žxry¡ ˆ v`‹ux¯‚„„|Žxrt…?twts~x®|"‚ ¹:º †&ˆ š‚:‚…?vŒt`›»©ƒrv`“
ˆ s~‚„ƒ&yrv`‚vŒ `‚Š Œsu‘˜‘twsuxtn|Ž‚{¹–º¼™ †u†°ˆ ˜‚½‚„˜…Vv`tŒ›©»©ƒrv“&¾rxrtwƒ^‚„|~xrt…?˜‚w‚„˜xr‹?|h¿|~…¢tw‹uxD|Ž‘1|"‚
¹GºÀ™ †u†½Á*Âuà º€™ ÂÃlˆ ˜‚–‚„…?vŒt`›9o<prqrqsutwv Ä?ź † |~xry&ėÆ^º ›

Ç Lr?L ›Gz¬‚©”nƒD|Ž‚n‚…?vhyrs<v`t½Ètw £ƒrvŒypr‘v:˜‚t©v`‚„|~xt…?ttwsuxD³
z¬‚SÉ~Ê †lˆ š‚wË‚…?vŒt`›

Ç r L :Ì ›>z¬‚Í”nƒD|"‚Í‚…?v½ys<v`tÍz ˆ v`‹uxVv‚„„|Žxrt…?twts~x³®ÎIÏ{s~‚v~ÐH»©ƒv{xrsyrv`t–…žprtт͔–|~š‚9/s~


|~xFy‘vh £ƒD|~xxrvŒ‘ |ŽÒ‚vŒ©v‚„prwxrx‹°‚sVo‚„v`qc™ÓtwvŒvÔq$› Â Ê s~ “usup ˆ ssu·›ÖÕ
z¬‚S× Âu°ˆ š‚wË‚…?vŒt`›

Ç LrVJ ›>z¬‚n”nƒD|Ž‚n‚„˜…VvSyrs<v`tnz ØÙt½wv`‚„|~xrtw…Vš‚‚vŒyFt˜‹uxD|~‘$wv3|~ £ƒ&©³


z¬‚SÉ Âu°ˆ š‚wË‚…?vŒt`›

Ç r L Ô7 ›>«ŠsvŒtG¡wv`/„|Žxž/s~…}‚„|~xrtw…Vš‚‚„˜xr‹Š|"‚G˜‚„tt £ƒrv`yrpr‘v`y—wv`‚„|~xrtw…V˜tt˜suxž‚„˜…Vv3³—Úȃ“
su¬”nƒ“Fxrs~‚£³
Û Œv t`Ÿ ˆ vŒ 3|Žprtv—‚ƒrv?‘xvV˜t ˆ r p tw“¯/su…Üz ØÝt v‚„„|Žxrt…?twts~x$›F}”n‘˜‘H”¬|Ž˜‚:prx‚„˜‘9‚ƒrvV‘˜xrv°˜t
y‘v~Ÿ<qr‘pt{|Žx&|Žyryr˜‚suxr|~‘$ÞuÊ ˆ š‚wß‚„v`…Vt`Ÿ ˆ v`/suwvŠ‚„Ñ“<˜xr‹l‚„s°v‚„|~xrt…?˜‚½|Ž‹|~x+›
à$áâ~ãnäSåŽæZç'è ™

Ç Lr? ›9¨¬|~xF‚„ƒrvԁv‚„|~xrt…?twt˜suxrt¬/s~…ézê|~xry&렌su‘˜‘yv³FÚȃ“Fsu¬”nƒ“FxrsŽ‚±³
Ï sŸ$t˜xr Œvž‚ƒrvž¾Dtт ˆ ˜‚Šs~9z ØÙthv`‚„|~xt…?ttwsux |Žš¥uv`tÔ|Ž‚Ô ˆ v/suvžêtт£|~Ñ‚„thš‚„tŠwv`‚„|~xrtì
{
…?ttwsux+ŸSé”n‘˜‘Ss ˆ tvŒÑ¥uv¯‚„ƒrv ‘˜xrvg˜t ˆ prtw“í|ŽxryÀyvŒ‘’|3“‚„tZwv`‚„|~xrtw…V˜ttwsux$Ÿ{ts§‚„ƒv ‚•”Ís
v‚„|~xrt…?twt˜suxrt¬”n‘˜‘+xrsŽ‚{ `su‘‘˜yrvS|~‹|~˜x$›

z| ˆ ‘vhs~ ‚„ƒrvÔv`x‚wvhqrs Œv`tt½t©tƒs'”nx ˆ v`‘s”ÔÐ


Ï syrvhz
{ Ï s<yv 
½
»©…?v ‰H¥uv`x‚ »©˜…Vv ‰H¥~vŒx‚
† » „|~xt…?ttwsuxFtт£|~Ñ‚„tŒðr/|~…?v † » „|Žxrt…?twts~xtт£|~Ñ‚„t`ðr/„|~…?v
‘˜vŒxr‹~‚ƒFt½|Ž‚n‘vŒ|~tw‚{× ™ ˆ ˜‚ ‘˜vŒxr‹Ž‚„ƒFtn|Ž‚½‘˜v3|~tт{× ™ ˆ ˜‚
‚…?vŒt ‚…?vŒt
™ †u† ´˜tт ˆ ˜‚©/wsu…éí|~w˜¥~vŒtŒð ™ †~† ´1tт ˆ ˜‚©/wsu…Tz¼|~wš¥uvŒt`ð
 `su‘‘˜t˜suxyrv‚„v` `‚„v`yg|~xyl¿|~…  `su‘‘˜twsuxyv`‚„v` `‚vŒyg|Žxryl¿|Ž…
tw‹uxD|Ž‘+‚„|~xrt…?twt˜suxFtw‚£|Žw‚„t tw‹uxr|~‘+‚„|~xrtw…V˜tt˜suxZtw‚„|~w‚t
™ Âà ñ |~tт ˆ ˜‚ns~D¿|~…Ttw‹uxr|~‘$tv`x‚3ð ™ Âuà ñ |~tт ˆ ˜‚ns~D¿|~…õt‹~xD|~‘$twvŒx‚3ð
zê 3|Žx&wv`‚„Ñ“Z˜‹uƒ‚½|3”¬|3“ ˆ p‚ Èt £ƒvŒyrpr‘˜vŒt½v‚„w“|"‚{™ ÂÃ
ƒD|Žtn‚s?”–|~š‚nprx‚„‘+‘xvŠ‹usvŒt Á × ™ ˆ ˜‚–‚„…?vŒt
˜yr‘v
™ †u†  †u† –š‚„t©/s~…é렌sux‚xprvԂ„s ™ †~†  †~† ͏˜‚„t¬/wsu…ézï `sux‚„xprvԂ„s
|~wš¥uv |Žš¥uv
†u†  ÂuÂà ò |~…Tt‹~xD|~‘+/wsu…éí|~w˜¥x‹ †~†  ÂuÂuà ò |Ž…ét˜‹uxD|~‘+/wsu…Tz¼|~wš¥<˜xr‹
ÂuÂà ñ xv:‹~s<v`t©yr‘˜v~ðzêƒD|Žtn‚s
”–|~˜‚½Þ~Ê ˆ š‚¬‚„˜…Vv`t ˆ v/suv
‚„|~xrtw…Vš‚‚xr‹
ÂuÂà Ñ× Âu ó x‚„v`Ñß/„|~…?vԋ|~q®ÎIzô”–|~˜‚t
‚ƒrv:ÞuÊ ˆ ˜‚©‚…?vŒt£Õ
× Âu zêtw‚„|~w‚tnv`‚„|~xt…?ttwsux
É ~  ´1tт ˆ ˜‚©/wsu…Tz¼|~wš¥uvŒt
É~Ê † ö v`‚„|~xt…?ttwsuxFtw £ƒrvŒyrp‘vŒy+Ÿ
ˆ p‚n‚„ƒrvԑ˜xrvŠ˜t ˆ prtw“~ŸDtsV
ƒr|~t©‚„s°”¬|~š‚nprx‚„˜‘+‚„ƒrvԑ˜xrv
˜t©yr‘˜v?Î Á ÞuÊ ˆ ˜‚э˂„˜…Vv`t£Õ
ˆ v`/s~vh‚„|~xrt…?˜‚w‚„˜xr‹
à$áâ~ãnäSåŽæZç'è Â

  QŠþ W  T\cm–WlQS]Hb

¨ suxrtwyrv`h‚„ƒrvl¾D‹upv ˆ v`‘s”œtwƒrs”nxr‹&| Ds”œqD|Žtt˜xr‹F‚„ƒrwsupr‹uƒ™‘v3|Ž·“ ˆ pr £·~v‚„t ˆ v/suv°˜‚
–
vŒx‚vŒtn‚„ƒv:xv`‚•”Ísu·›

Rate Rate
100 pkts/sec 1000 pkts/sec

Bucket Bucket
size size
3000 1

Packets remove send


Token remove to
wait token token
network

Šx—‚„ƒvSxrv±¸<‚¬qD|~‹uvŽŸ<“us~pZ|~v{tƒrs”nx  r s'” ˆ vŒƒr|¥˜sut`›9¨– `‘vn‚„ƒrs~tvS‚ƒD|Ž‚¬ `supr‘˜y—ƒD|3¥uv ˆ v`vŒx


‹uv`xrvŒ|Ž‚„v`y ˆ “‚„ƒv ‚£|~xyrvŒ… 
‘vŒ|~·“ ˆ pr £·~v‚Ôq5su‘˜ `vŒ½|~xry ˆ wv r“v¸<qr‘’|Žx&“~suprh|Žxrtw”ÍvŒ?ÎҔnƒ“
su¬”nƒ“Fxrs~‚£Õ–/su©v3|~ £ƒ 3|Žtv~›

2 0 #`ž
h„|~qrƒ ˜t͏˜xr Œsuwv` `‚ ˆ v` 3|~prtwvS‚„ƒvSqv3|~·°„|"‚„v½s~ †u†~† qD|Ž £·~v`‚t©q5v`ÍtwvŒ `suxryZt9suxr‘š“?|~‘‘˜s”–v`y
‚„s° `sux‚„xprvh/su ÷ tv` ŒsuxyrtŒŸxrs~‚  tv` ŒsuxyrtŒ›
h„|~qrƒ&™žtn `suwvŒ `‚Œ›
h„|~qrƒ ÷  tnx ŒsuwvŒ ‚ ˆ v` 3|~prtwv:‚ƒrvŒwv ˜t½|°qv3|Ž·Z„|Ž‚v:sŽ †~†u† qD|~ £·~v‚„t{q5v`{twvŒ Œs~xry$Ÿts?˜‚n˜t
…?qsuttw ˆ ‘˜v{‚„s?tv`xry ÷ †uu† † qD|~ £·Žv`‚tSxF|°t˜xr‹u‘˜vŠtv` Œsuxry+›
h„|~qrƒ  tn `suwvŒ `‚Œ›
à$áâ~ãnäSåŽæZç'è ×

Packets delivered
to network
by time t seconds 12200
12100
12000

11000

10000

9000

8000
6000 6001 6002 6003 6004 6005 6006

t seconds

Packet delivered
to network by time 12200
t seconds 3250

2250

1250

250
150
50
6000 6001 6002 6003 6004 6005 6006

time t seconds

Packets delivered
to network by 3330
3230
time t seconds

230
200
150
6000 6001 6002 6003 6004 6005 6006

time t seconds

Packets
delivered
to network
by time t seconds

600,700
600,600

600,100
600,000
6000 6001 6002 6003 6004 6005 6006 6007

time t seconds

´1‹uprwv 
ÐG´˜‹uprv{/su Gws ˆ ‘˜vŒ… ÷
Carnegie Mellon
Computer Science Department.
15-441 Fall 2006
Midterm

Name:
Andrew ID:

INSTRUCTIONS:
There are 16 pages (numbered at the bottom). Make sure you have all of them.
Please write your name on this cover and at the top of each page in this booklet except the last.
If you find a question ambiguous, be sure to write down any assumptions you make.
It is better to partially answer a question than to not attempt it at all.
Be clear and concise. Limit your answers to the space provided.

Question A B C D E
Points / 34 / 24 / 22 / 16 /4
3. In the network depicted below:

u1
w1

AS U AS W

AS Y AS Z
AS X
y1
z1

x1

AS V
Customer−>Provider

Peer−Peer v1

which paths may packets take between a pair of end-hosts under valley-free routing?

T F x1 → AS X → AS U → AS W → w1

T F v1 → AS V → AS Y → AS Z → AS W → w1

T F v1 → AS V → AS Y → AS Z → z1

T F x1 → AS X → AS Y → AS Z → z1

Solution: T -
F - goes over a peering link from Y to Z before going to Z’s provider, which violates valley-free
routing.
T-
F - goes through 2 peering hops

Page 4
v

C Routing and Bridging and Bears, oh my!


host3 eth0: host4 eth0:
128.2.19.6 128.2.19.7
c4:a8:6b:bb:a2:64 c4:a8:6b:4b:c3:11
External Link
CiscoSystems
Cisco 7000 SERIES

Link 1 router1 eth1:


128.2.17.34
Link 2 CiscoSystems
Cisco 7000 SERIES

de:a4:fe:03:4d:8a
Ethernet Switch 1
router2 eth0:
router2 eth1: 128.2.17.35
128.2.19.1 de:a4:fe:03:2c:4f
c4:a8:6e:32:cc:7b

host2 eth0: host1 eth0:


128.2.19.5 128.2.19.4
c4:a8:6b:1f:a5:32 c4:a8:6b:10:4b:c9

In the partial network topology shown above, a well-formed IP packet with a destination IP of 128.2.19.5
and TTL of 8 arrives at router1 via the external link. Link1 uses the subnet 128.2.17.34/31 and Link2
has the subnet 128.2.19.0/25 .

The hosts and routers on the ethernet subnet are all connected to their own port on an ethernet switch
(a learning bridge).
8. What is the subnet mask of eth0 on host1? (2 points)

Solution: 255.255.255.128

9. What are the forwarding entries used by each router to forward the packet to 128.2.19.5? (5 points)

Router Destination Mask Next-Hop Interface

router1

router2 128.2.19.0 255.255.255.128 (/25) directly connected eth1

Router Destination Mask Next-Hop Interface


Solution:
router1 128.2.19.0 255.255.255.128 128.2.17.35 eth1

Page 7
10. If this packet (from the outside to 128.2.19.5) is the first packet to be forwarded on the network, ARP
requests will be sent out on both Link1 and Link2. Fill in the following ARP header fields. (4 points)

Link MAC Source Address MAC Destination Address IP address queried for

Link1

Link2

Link MAC Src Addr MAC Dest Addr IP address queried

Solution: Link1 de:a4:fe:03:4d:8a ff:ff:ff:ff:ff:ff 128.2.17.35

Link2 c4:a8:6e:32:cc:7b ff:ff:ff:ff:ff:ff 128.2.19.5

Page 8
D DNS
Elisa wants to listen to the National Public Radio news over the Internet. She starts her favorite audio
player and points it to ra1.streaming.npr.org. The audio player calls gethostbyname() with the given
name to obtain the IP address of the server. As a result of the gethostbyname() call, the local resolver
in Elisa’s machine contacts the local DNS server to translate the host name into an IP address. The
local DNS server performs an iterative lookup. The table below contains the DNS distributed database.
A row corresponds to a DNS record. The records are grouped by DNS server.

Record Name TTL IN Type Value


# (sec)
localdns.localdomain.com
R1 . 262542 IN NS E.ROOT-SERVERS.NET.
R2 E.ROOT-SERVERS.NET. 348942 IN A 192.203.230.10
E.ROOT-SERVERS.NET
R3 org. 172800 IN NS F.GTLD-SERVERS.NET
R4 F.GTLD-SERVERS.NET 172800 IN A 192.35.51.30
F.GTLD-SERVERS.NET
R5 npr.org 172800 IN NS watson.npr.org.
R6 watson.npr.org. 172800 IN A 205.153.37.175
watson.npr.org
R7 streaming.npr.org. 172800 IN NS ns.streaming.npr.org.
R8 ns.streaming.npr.org 172800 IN A 205.153.36.175
ns.streaming.npr.org
R9 audio.streaming.npr.org. 172800 IN CNAME ra1.streaming.npr.org.
R10 ra1.streaming.npr.org. 10 IN A 205.153.36.175

14. In the figure below, draw arrows to indicate the sequence of queries and responses exchanged among the
different machines. Label each arrow with a sequence number, and fill in the table below to indicate the
following information: (12 points)
• Sequence number indicating the ordering of the message exchanges.
• Message Type: use Q for Query or R for Response.
• Data: For queries use the value of the question data. For responses, specify the record ID(s)
returned, if any, from the first column in Figure 1, e.g., R1, R2 ....
• You may use abbreviations for host names, e.g. “ra1” rather than ra1.streaming.npr.org.
The figure already contains an arrow indicating the first message from the local resolver to the local
DNS server. The sequence number is 1 (first message), type = Q (query) and the data is the host name
the application wants to resolve (ra1.streaming.npr.org). To make your sequence as simple as possible,
assume the server includes both the A and NS records when applicable, so include both of them in the
corresponding message.

Page 11
E.ROOT−SERVERS.NET

R3
R4 F.GTLD−SERVERS.NET

R5
R6

watson.npr.org

1 localdns.localdomain.com R7
R8
R1
R2

ns.streaming.npr.org

R9
R10

Eliza’s Computer

Seq Type Data


1 Q ra1.streaming.npr.org(A)

Page 12
E.ROOT−SERVER.NET

R3
R4
F.GTLD−SERVERS.NET

R5
R6

4
2
3 5

watson.npr.org
6
localdns.localdomain.com R7
R8
.or g
g.npr R1 7
.str e amin
r a1 R2
1, Q:
8

10 ns.streaming.npr.org
9
R9
Elisa’s computer
R10

Figure 2: DNS Query & Response sequence.

Seq # Type Data


1 Q ra1.streaming.npr.org (A)
2 Q ra1.streaming.npr.org (A)
3 R R3 (NS), R4 (A)
4 Q ra1.streaming.npr.org (A)
5 R R5 (NS), R6 (A)
6 Q ra1.streaming.npr.org (A)
7 R R7 (NS), R8 (A)
8 Q ra1.streaming.npr.org (A)
9 R R10 (A)
10 R R10 (A)
The local DNS server exchanges a total of 10 messages.
Points were deducted as follows:
−2 pts for missing or incorrect message.
−2 pts for missing record in a message.
−Message 9 should contain only R10. −1 pt if R9 was included.
−Message 10 should contain only R10. −1 pt if R9 was included.
Solution: −Iterative from the client (not the local dns server) −5 pts.

Page 13
15. Eliza repeats her query two minutes later. Show what happens for this subsequent query. (4 points)

E.ROOT−SERVERS.NET

R3
R4 F.GTLD−SERVERS.NET

R5
R6

watson.npr.org

1 localdns.localdomain.com R7
R8
R1
R2

ns.streaming.npr.org

R9
R10

Eliza’s Computer

Seq Type Data


1 Q ra1.streaming.npr.org(A)

Page 14
11. Assume in the network there is only customer-provider relationship and that AS 3 is the only tier-1 ISP.
In addition, the following are two valid paths:
• Path 1: 1 → 3 → 4 → 2
• Path 2: 1 → 3 → 5 → 6

AS1 AS6
AS5
AS3

AS4

AS2

Please mark the edges in the figure below to indicate the customer-provider relationship (customer →
provider).

AS1 AS6
AS5
AS3

AS4

AS2

Solution: 4pts total, -2 per wrong arrow


See figure below. The arrow between AS3 and AS5 can be either way.

Page 7
AS1 AS6
AS5
AS3

AS4

AS2

Page 8
D DNS
For answering the following question, consider the following name servers and mappings they contain:

local name server 128.2.184.224


Name Value Type Class TTL
com a.gtld-servers.net nstld.verisign-grs.com SOA IN 1 day
a.gtld-servers.net 192.5.6.30 A IN 1 day

a.gtld-servers.net name server


Name Value Type Class Additional Info TTL
google.com ns1.google.com NS IN 216.239.32.10 1 day

google.com name server


Name Value Type Class TTL
www.google.com 72.14.204.105 A IN 10 minutes

15. Suppose a client queries the local name server for the IP address of www.google.com. The local name
server recursively resolves the request and cache the results. Write down the requests and responses
the local nameserver will perform and the answer it eventually sends back to client. Number steps
sequentially in the table below.
We have started from the initial client request to the local name server and the first request the local
name server performs in servicing the query.

Request /
Source Destination Name Value Additional Info
Response
Request 1 client local name server www.google.com
Request 2 local name server a.gtld-servers.net google.com
Response 2

Solution:

Page 10
Request / Additional
Source Destination Name Value
Response Info
local name
Request 1 client www.google.com
server
local name a.gtld-
Request 2 google.com
server servers.net
a.gtld- local name
Response 2 google.com ns1.google.com 216.239.32.10
servers.net server
local name
Request 3 ns1.google.com www.google.com
server
local name
Response 3 ns1.google.com www.google.com 72.14.204.105
server
local name
Response 1 client www.google.com 72.14.204.105
server
2pts per line correct

Page 11
16. 11 minutes later the same client queries the local name server for www.google.com. List out the requests
and the responses from the point of view of the local name server and the response it eventually sends
back to client.
Start with the request of the client to the local name server and number request/response pairs as in
the previous part of this question.

Request /
Source Destination Name Value Additional Info
Response

Solution:

Request / Additional
Source Destination Name Value
Response Info
local-name
Request 1 client www.google.com
server
local-name
Request 2 ns1.google.com www.google.com
server
local-name
Response 2 ns1.google.com www.google.com 72.14.204.105
server
local-name
Response 1 client www.google.com 72.14.204.105
server
3pts per line correct

Page 12
E Bridging and Switching
A small company has the network topology shown below. In this topology there are four Ethernet
segments (L1, L2, L3, and L4) interconnected with a hub H and router R. Nodes N1, N2, N3, N4, N5,
and N6 are endsystems. Endsystems do not forward packets.

N1 N3
L1 N2 L2

H R
N5
L4 N6 N4 L3

17. In this problem, use the following notation: the MAC address of node N1 is n1 (lower case), its IP address
is N1 (UPPER CASE). If a node has multiple IP or MAC addresses, use the index of the segment to
differentiate between them. For example, host N2 has two different IP addresses, N2[L1] and N2[L2],
since it is on two LANs. The first line in the table provides an example entry for a packet from N1 to
N2 on link L1.
Suppose host N6 transmits a packet to N3. In the following table, give the MAC and IP source and
destination addresses of the packet as it is observed traveling on the different links.
Location Link MAC Source MAC Destination IP Source IP Destination
N1 to N2 L1 n1 n2[L1] N1 N2[L1]

N6 to N3 L4

N6 to N3 L3

N6 to N3 L2

Solution:
Location MAC Source MAC Destination IP Source IP Destination
N1 to N2 on L1 n1 n2[L1] N1 N2[L1]

N6 to N3 on L4 n6 r[L3] N6 N3

N6 to N3 on L3 n6 r[L3] N6 N3

N6 to N3 on L2 r[L2] n3 N6 N3

Page 13
2pts per line

18. If we move N6 to L2, do we need to reconfigure N6? If so, how?

Solution:
need a new IP address
2pts

Page 14
19. If we move N6 to L3, do we need to reconfigure N6? If so, how?

Solution:
no
1pts

20. N3 is transmitting a large number of broadcast packets on L2.


(a) Will this affect the performance of N6’s file transfer to N5? Explain.

Solution:
no effect
2pt

(b) If it has an impact on the transfer, what can we replace node H with to reduce the impact? Note
that you should select a replacement device that addresses the problem *AND* that requires the
minimum amount of reconfiguration in the network.

Solution: no change
0pt

21. N4 is transmitting a large volume of data to N3.


(a) Will this affect the performance of N6’s file transfer to N5? Explain.

Solution: yes...
2pt

(b) If it has an impact on the transfer, what can we replace node H with to reduce the impact? Note
that you should select a replacement device that addresses the problem *AND* that requires the
minimum amount of reconfiguration in the network.

Solution: bridge
1pt

22. N4 is transmitting a large number of broadcast packets on L3.


(a) Will this affect the performance of N6’s file transfer to N5? Explain.

Solution: yes
2pt

(b) If it has an impact on the transfer, what can we replace node H with to reduce the impact? Note
that you should select a replacement device that addresses the problem *AND* that requires the
minimum amount of reconfiguration in the network.

Solution: router
1pt

Page 15
15-441: Computer Networks
Homework 1
Assigned: January 29, 2008
Due: February 7, 2008

1. Suppose a 100-Mbps point-to-point link is being set up between Earth and a new lunar colony. The
distance from the moon to Earth is approximately 385,000 km, and data travels over the link at the
speed of light—3 ∗ 108 m/s.
(a) Calculate the minimum RTT for the link.
(b) Suppose Mission Control on Earch wishes to download a 25MB image from a camera on the lunar
base. What is the minimum amount of time that will elapse between when the request for the data
goes out and the transfer is finished?
(c) Using the RTT as the delay, calculate the delay*bandwidth product for the link.
(d) Imagine that Mission Control requests one 25MB image and then waits until it starts receiving the
file before sending another request (the size of the request is negligible). Use the delay*bandwidth
product to determine what percentage of the link is utilized.

Solution:
(a) The time for data to travel from earth to the moon is:
(385,000km∗1000m/km)
3∗108 m/s = 1.28333s
So the minimum RTT is 1.2833 ∗ 2 = 2.56666s

(b) From (a), the request will take 1.28333s to reach the moon. The time to put the picture on the
link is:
25MB∗1024kB/MB∗1024byte/kB∗8bits/byte 209715200
100Mbps∗1000kb/Mb∗1000bits/kb = 100000000 = 2.097152s
Then it will take another 1.28333s to return to earth. The total time is:
2 ∗ 1.28333s + 2.097152s = 4.66382

(c) 2.56666s ∗ 100M bps ∗ 1000000bits/M b = 256666000bits


(d) The cycle time for this is 1 RTT. From (c) we see that the link would be fully utilized if
256666000 bits were transferred during this time. The total number of bits transferred is:
25M B ∗ 1024kB/M B ∗ 1024bytes/kB ∗ 8bits/byte = 209715200bits
The link utilization is 209715200/256666000 = 81.707%

If you assume that the earth doesn’t send a request until the entire picture has been received,
then the time for a cycle is 4.66382 seconds from (b).
4.66382s ∗ 100M bps ∗ 1000000bits/M b = 466382000bits
209715200/466382000 = 44.923%

1
2. Calculate the latency (from first bit sent to last bit received) for the following:
(a) A 10-Mbps link with a single store-and-forward switch in the path, and a packet size of 5,000 bits.
Assume that each section of the link introduces a propogation delay of 10 microseconds, and that
the switch begins retransmitting immediately after it has finished receiving the packet.
(b) Same as (a) but with three switches
(c) Same as (a) but assume the switch implements cut-through switching: it is able to begin retrans-
mitting the packet after the first 200 bits have been received.

Solution:
(a) To put the packet on the first link it will take:
5000bits
10−Mbps∗1000000bits/Mb = 0.0005s = 0.5ms
Then it will take another .01 ms for the switch to finish receiving the packet for a total of .51
ms. It will take another .51 ms for the switch to send, and then for the destination to receive
all of the packet. The total latency is:
2 ∗ 0.51ms = 1.02ms
(b) From (a) we know that each link section will take .51 ms. The total time will be: 4 ∗ 0.51ms =
2.04ms
200bits
(c) To begin we can calculate the time it will take to send the first 200 bits: 10−Mbps∗1000000bits/Mb =
0.00002s = 0.02ms
Then .01 ms later the switch can start sending the packet. It will take .5 ms (from (a)) to put
the entire packet on the wire (As the switch is sending out the packet, it will continue receiving
the rest of the packet). Then it will take .01 ms for the destination to finish receiving the entire
packet:
0.02ms + 0.01ms + 0.5ms + 0.01ms = .54ms

3. Do Exercise 1 from Chapter 3 in the textbook (Computer Networks: A Systems Approach Edition 4).
For each connection it is fine to write out only the new table entries that would be added for each router
instead of rewriting the full table each time.

Switch In Port In VCI Out Port Out VCI


(a) 1 2 0 1 0
2 3 0 0 0
3 0 0 3 0
(b) 1 3 0 1 1
2 3 1 1 0
4 3 0 1 0
(c) 2 2 0 0 1
3 0 1 2 0
Solution:
(d) 1 0 0 1 2
2 3 2 0 2
3 0 2 3 1
(e) 4 2 0 3 1
2 1 1 0 3
3 0 3 1 0
(f) 4 0 0 3 2
2 1 2 3 3
1 1 3 2 1

Page 2
6. You are working for a company that delivers digital pictures to users over different types of networks.
You are developing a new product that will use a network link that has a bandwidth of 1MHz. Your
boss asks two of your colleagues, Bob and Jane, to estimate how long it will take to transfer 1 MByte
images over the channel.
(a) Jane took a networking course and vaguely remembers something about Nyquist. She uses the
Nyquist limit - what answer does she get?
(b) Bob took the same course but was more impressed by the slide on Shannon. He applies the Shannon
formula. He assumes that the signal-to-noise-ratio is 30 dB (that is after all, what was on the slide
in class). What answer does he get?
(c) Your boss is unhappy. He did not expect to get two different answers and he calls you in to explain
the difference. What do you say?

Solution:
(a) 2 * 1MHz = 2Mbps
(b) 30 dB = 10 * log(S/N) ; S/N = 1000.
C = 1 MHz * log2 (1 + 1000) = 9.967 Mbps
(c) The Nyquist limit assumes a binary amplitude encoding. Shannon’s theorem allows for more
aggresive encodings. This explains why that formula results in a higher bandwidth. Shannon’s
theorem also takes noise into consideration.

Page 5
15-441: Computer Networks
Homework 2
Assigned: Feburary 19th
Due: Feburary 28th

1. Frank Fandango runs a 10Mbit/s Ethernet between the CMU campus and the homes of his friends. All
of these hosts are in a single broadcast domain. Fortunately, they are located just within the maximum
distance of an Ethernet. The total size of an Ethernet can be about 2.5 kilometers, , and an Ethernet
has a minimum packet size of 512 bits.
Frank upgrades his network to 100Mbit/s Ethernet, and notices that when only one person sends at a
time, or when he sends very large packets, his network works. But when many people send very small
packets, things don’t work at all.
(a) Explain how a minimum packet size can help to detect collisions in Ethernet:

Solution: Consider the extreme case, suppose there is no minimum packet size, host A at one
end sends a frame of only 1 bit to host B at the other end. After sending the 1-bit frame, host
A is convinced that there is no collision because it does not hear any interference. However,
the frame is still on its way to the other end, and if host B sends another frame at this time,
collision can happen. To determine the minimum packet size, consider the worst case for
Ethernet’s collision detection:

1. At t0 : A sends a frame
2. At t0 + prop: B sends another frame right before it can carrier sense the A’s frame
3. At t0 + 2 ∗ prop: A is still transmitting while the B’s frame arrived at A

thus the minimum packet size is 2 ∗ prop ∗ bandwidth.

(b) Help Frank out. Compute the threshold of how big packets must be in order for things to work:

Solution:
One solution: The Ethernet is 10 times faster, and Frank’s users were at the boundary.
Therefore, the packets must be 10 times larger – 5120 bits.
Another solution: Calculate the propagation delay as 2500/(1.8 ∗ 108 ) = 14µs, and then the
minimum packet size is 2∗14∗10−6 ∗100∗106 = 2800 bits. Note that the result is different from
the first solution. This is because the design choice of 512 bits in 10Mbps Ethernet is roughly
twice conservative, to take into consideration of many practical factors, e.g. slower propogation
speed, delay introduced by repeaters, etc.

(c) One solution that Frank came up with is to raise the minimum packet size to the answer from part
(b). Suppose that Frank cannot modify the minimum packet size, move the endpoints, lay new
cable, or change the software or configuration on the endpoints. You may add new devices to the
network. How could Frank change the topology to fix his problems anyway?

1
Solution:
full credit: Add bridges or switches to separate the network into multiple collision domains.
partial credit: Add routers. Adding routers would require that he change the IP address /
gateway configuration on the hosts.

2. For this question, assume that the routers use RIP to calculate their forwarding tables.

(a) Fill in the routing table for node A, after convergence.

Solution:
Destination Cost Next Hop
A 0 -
B 1 B
C 1 C
D 2 B
E 2 C
F 3 B/C

(b) After convergence, node E goes down. Fill in the final routing table for B, after re-convergence.

Solution:
Destination Cost Next Hop
A 1 A
B 0 -
C 1 C
D 1 D
E 16/∞ -
F 2 D

3. Imagine the Internet is divided into the Autonomous Systems shows below. In this problem we assume
NO subnetting and NO supernetting and NO CIDR is used. A packet is being sent from Host H1 to
Host H2. The packets takes the following route: H1 −→ R1 −→ R2 −→ R3 −→ R4 −→ R5 −→ R6 −→
H2

Page 2
Some information: R2, R3, R4, and R5 are gateway routers. Assume that there are many routers
and networks within each AS that are not shown. Assume also that there are NO default
entries in routers. Please answer the questions below in 10 words or less. We are NOT
looking for numerical answers.
(a) Which of the labeled routers above likely use the BGP routing algorithm to create their forwarding
tables?

Solution: R2, R3, R4, R5. Recall that gateway routers speak BGP when computing routes

(b) How many entries does R1’s forwarding table have?

Solution: Number of networks in the AS containing R1. Recall that R1 needs to be able to
reach any of the networks within its AS, not just those networks that it is directly connected
to.

(c) Assume that host H1’s IP address is 205.96.17.172, What can we say about the IP address of R1

Solution: It has the same network number prefix as H1, namely 205.96.17. Recall that H1
must have the same network number as R1, since R1 is the next IP hop from H1 and thus R1
has an interface on the same network as H1. Observing that H1 has a class C IP address, we
know that R1 and H1 share the network number 205.96.17.

(d) Give an example of an entry in R1’s forwarding table (don’t leave out any fields).

Solution: (205.95.17, 2, 8:0:2b:e4:b:1:2) where (network prefix, outing interface, MAC)

(e) How many entries are there in R2’s forwarding table?

Solution: Number of networks in whole Internet. Remember that R2 is a gateway router and
thus needs to know about every network in the Internet.

(f) Suppose AS X thinks that AS Y drops too many packets. Using only BGP, is it possible for AS
X to implement a policy stating that “traffic outbound from my AS should not cross Y ?” Why or
why not?

Page 3
Solution: Yes, assuming it has an alternative route. Prefer paths that don’t contain Y . Of
course, if the only path to a destination contains Y , it can not reach that destination without
going through Y .

(g) Now suppose AS X thinks that AS Y generates a lot of illegal file sharing traffic. Using only BGP,
is it possible for AS X to implement a policy stating that, “I don’t want to carry traffic from Y
to my customers?” Why or why not? Assume that AS X does not want to deny transit to traffic
from any other AS.

Solution: Not in general. Traffic from a neighbor might be from both good ASs and Y . BGP
can only accept all the traffic by advertising a route or deny all of it by not advertising.

4. Maggie decides to start a small company. She asks her ISP, Acme Networks, to give her enough addresses
for 1200 hosts. ACME allocates a subblock from the 192.1.* address range that they own and tells Maggie
to use the following addresses:

192.1.0.*
192.1.1.*
192.1.2.*
192.1.3.*
192.1.4.*
(a) Maggie has heard that the size of the Internet routing table has grown to huge proportions, and
that to be a good citizen, she should announce the fewest number of routes possible to exactly cover
her IP addresses.
Under CIDR, what is the smallest set of network numbers that the rest of the world would use to
describe Maggie’s networks (please use address & prefix format - e.g. 128.2/16)?

Solution: 192.1.0/22 and 192.1.4/24

(b) Maggie has a second ISP that she uses, RoadRunner Networks. She announces some of her network
addresses to both Acme and RoadRunner. (Maggie hadn’t talked to you yet—these announcements
do not correspond to the answers you provided to the previous question). As a result, some router
far away in the network produces a forwarding table with the following entries:
Destination Next Hop
192.1/16 1.2.3.4
192.1.0/23 1.2.3.5
192.1.4/24 1.2.3.6
192.1.1/24 1.2.3.7
Which next hop should the router use for a packet destined to 192.1.0.1?

Solution: Using longest prefix match, it should use 1.2.3.5

Page 4
15-441 Computer Networks
Homework 3
Due: April 15, 2008, 1:30 PM
Lead TA: Xin Zhang (xzhang1@cs.cmu.edu)
April 8, 2008

A How does TCP update its window


At time t, a TCP connection has a congestion window of 4000 bytes. The maximum segment size used by
the connection is 1000 bytes. What is the congestion window after it sends out 4 packets and receives acks
for all of them? Suppose there is one ack per packet.
(a) If the connection is in slow-start?

Solution: 8000 bytes. In slow start, the sender increases its window for each byte successfully
received.

(b) If the connection is in congestion avoidance (linear mode)?

Solution: 5000 bytes. The sender increases its window by one segment each window.

1
B Label Switching

You are trying to debug a problem with your company’s virtual circuit-based network. A diagram of the network
is shown below. A, B, and C are hosts attached to the network. S1, S2, and S3 are switches configured to act as
label swapping virtual circuit switches.
1

S2 2
4 B
3

A S1 2
4

2
4 S3 C
3
The label swapping tables for the switches are configured as follows. Some of the entries are stale and not
actually in use right now.
Switch Input Port Input Label Output Port Output Label
S1 2 2 3 4
S1 4 2 3 1
S1 4 17 2 2
S2 2 19 4 2
S2 3 1 2 19
S2 3 2 2 15
S2 3 5 4 2
S2 4 2 2 1
S2 4 1 4 1
S3 2 1 1 2
S3 2 2 4 5
S3 4 1 1 1
S3 4 4 1 5

Page 2
Write the sequence of (Switch, Input Port, Input Label) tuples and the destination node and label for
each of these packets. We’ve given you the start node and starting label. The intermediate tuples should
look like (S1, 1, 999) [e.g., switch S1, input port 1, label 999].
(a) Start node A, label 17. Switch tuples:

Solution: (S1, 4, 17) (S2, 4, 2)

Dest node and final label:

Solution: B, 1

(b) Start node A, label 2.


Switch tuples:

Solution: (S1,4,2) (S3,4,1) (S2,3,1)

Dest node and final label:

Solution: B,19

(c) Start node C, label 1.


Switch tuples:

Solution: (S3,2,1) (S2,3,2)

Dest node and final label:

Solution: B,15

C Why UDP vs TCP?


(a) Give one reason that DNS lookups are run over UDP rather than TCP:

Solution: OK: Connection-setup overhead, short-duration interaction NOT OK: Header overhead

(b) Give one reason that streaming multimedia is run over UDP rather than TCP:

Solution: OK: Variable delays from reliability, loss tolerant applications, drastic congestion control
NOT OK: connection setup overhead

Page 3
D Pick the true choices about congestion collapse and backoff
Otto Pilot creates a new network for the 150 PC computers he mounted within his car. Each computer
sends indepenent UDP query/response packets to the other computers in the car when it needs to know or
do something. Requests are retried after a time out that is a fixed, small multiple of the typial response
time. After running the OttoNet for a few days, Otto notices that network congestion occasionally causes a
congestion collapse because too many packets are sent into the network, only to be dropped before reaching
the eventual destination. These packets consume valuable resources.
Suppose each response or request can be fit into one packet. Which of the following techniques is likely
to reduce the likelihood of a congestion collapse? (Circle ALL that apply)
A. Increase the size of the queue in each router from 4 packets to 8 packets. Suppose the timout value
is appropriately adjusted accordingly to the queue length.

Solution: Yes. There are two possibilities for the timeout value. First, suppose that Ben
used the answer to question 9 to set the timeout. Given a fixed timeout, lengthening queues
would increase, not decrease, the chance of congestion collapse. The longer queues may cause
clients to time out and resend their request packets, even though a response may already be on
its way back. Second, suppose that Ben adjusted the timeout for the longer queues. Doubling
queue lengths certainly doesnt prevent congestion collapse, because congestion collapse can
occur with queues of any length. There is no a priori reason to believe that it is less likely
with 8-packet queues than with 4-packet queues. Increasing the size of the queue to 8 packets
might have a positive effect: some packets that would otherwise have been dropped might
eventually reach their destination. However, it might also have a negative effect: packets that
would otherwise have been dropped remain in the system and may cause congestion elsewhere.

B. Use exponential backoff in the timeout mechanism while retrying queries.

Solution: YES. Exponential backoff reduces the injection rate of packets to a level that the
network can tolerate.

C. If a query is not answered within a timeout interval, multiplicatively reduce the maximum rate at
which the client application sends OttoNet query packets.

Solution: YES. If this question had said “current” rather than “maximum” rate, it would
have exactly been exponential backoff. Reducing the maximum rate eventually produces the
same end result.

D. Use a TCP style flow control window (per session) at each receiver to prevent buffer overruns.

Solution: NO. Flow control windows apply to streams of data. OttoNet requests are not
streams, they are independent packets, each one of which may be delivered to a different
server, so a flow control window is not applicable. Moreover, flow control is an end-to-end
mechanism to ensure that a slow receivers buffers dont get overwritten by a fast sender. But
the problem states that the server and client processing are both infinitely fast, so adding flow
control would not accomplish anything.

E Congestion Window
Consider the following plot of TCP window size as a function of time:

Page 4
45

40

35
Congestion Window Size

30
(segments)

25

20

15

10

0
0 5 10 15 20 25 30

Transmission Round
Assuming TCP Reno is the protocol experiencing the behavior shown above, answer the following ques-
tions.
(a) Identify the intervals of time when TCP slow start is operating.

Solution: 1-6, 23-26

(b) Identify the intervals of time when TCP congestion avoidance is operating (AIMD).

Solution: 6-23

(c) After the 16th transmission round, is segment loss detected by a triple duplicate ACK or by a timeout?

Solution: dupack

(d) What is the initial value of ssthreshold at the first transmission round?

Solution: 32

(e) What is the value of ssthreshold at the 18th transmission round?

Solution: 21

Page 5
(f) What is the value of ssthreshold at the 24th transmission round?

Solution: 13

(g) During what transmission round is the 70th segment sent?

Solution: 7

(h) Assuming a packet loss is detected after the 26th round by the receipt of a triple duplicate ACK, what
will be the values of the congesion-window size and of ssthreshold?

Solution: 4,4

F Buffers, Losses, and TCP

Harry Bovik is given the responsibility of configuring the packet queuing component of a new router. The link
speed of the router is 100 Mbit/s and he expects the average Internet round-trip time of connections through the
router to be 80ms. Harry realizes that he needs to size the buffers appropriately.
You should assume the following:
• You’re dealing with exactly one TCP connection.
• The source is a long-running TCP connection implementing additive-increase (increase window size by 1
packet after an entire window has been transmitted) and multiplicative-decrease (factor-of-two window re-
duction on congestion).
• The advertised window is always much larger than the congestion window.
• The loss recovery is perfect and has no impact on performance.
• The overhead due to headers can be ignored.
Harry argues that because the average RTT is 80ms, the average one-way delay is 40ms. Therefore, the
amount of buffering he needs for high link utilization is 100 Mbit/s * 40 ms or 500 KBytes.

Approximately what bandwidth will TCP achieve with this buffering?


Note: There are two approaches to solving this problem. The easiest way to solve it is to assume that
queueing delay does not increase the RTT. A more complete analysis will take queueing delay when the
router buffers are over-full into account. The non-queueing-delay analysis will receive 80% of the points for
this problem, so if you’re stuck, it’s much better to do the linear analysis than nothing, but we encourage
you to do the full analysis. It’s got some summations, but doesn’t actually require computing an integral

Solution: 10 points.
The buffering is not enough for TCP to fill the link. The window size with this buffering will go
between 1.5BW ∗ RT T and0.75BW ∗ RT T .

Page 6
1.5 BW*RTT

cwnd 1.0 BW*RTT

0.75 BW*RTT

Time
The above graph shows the rough behavior of the congestion window over time. The overly simplified
analysis:
During 13 of the connection, the window will be too small, using an average of (0.75 + 1)/2 = 87 of
the capacity. During the other two thirds of the time, it will fill the link. The total utilization will be
23
24 of the capacity, or about 95.8 Mbit/sec.
This analysis is overly simple, because it doesn’t take into account the fact that the RTT increases
by one packet’s worth each RTT when we’re sending a larger window than the buffer can handle. Exact
answer:
In going from a window of 750 packets to a window of 1500 packets, the source sends:

X
1500
i
i=750

packets. During this same amount of wall-clock time, an optimal scheme could have transmitted

X
1500 X
249
i+ i
i=750 i=1

packets. (The missing packets from the underutilized periods). Or:


P1500
throughput = P1500 i=750
P249
i=750 + i=1
1
= P249
1 + P1500
i=1

i=750

1
= 249∗250
1+ 2
1500∗1501−749∗750
2

1
= 31125 = 0.9645 = 96.45 Mbit/sec
1+ 844875

Page 7
15-441: Computer Networks
Homework 4
Assigned: Apr 23, 2008
Due: May 1, 2008
Lead TA: Xi Liu

1. Consider the following topology of wireless laptops A, B, C and D. The dotted lines indicate the range
of wireless transmissions from each node. For example, B is within range of A, A & C are within range
of B, B & D are within range of C and only C is within range of D. Assume that each node uses an
RTS/CTS based MAC protocol.

A B C D

(a) Use the figure to give an example of how RTS/CTS can help solve hidden terminal problem.

Solution: Consider when A transmits to B, and C transmits to D. Without RTS/CTS, there


will be collisions on B (B is the hidden terminal). With RTS/CTS, B is no longer a hidden
terminal because C can hear B’s CTS.

(b) RTS/CTS is usually disabled by default on commerical wireless routers, give one reason for this
choice.

Solution: One answer is that RTS/CTS introduces overhead and current wireless traffic is
mostly bursty (hidden terminal problem is not yet a very serious problem).

2. There are three forms of P2P lookup algorithms: centralized (napster), flooding-based (gnutella) and
routing-based (DHTs). Which of the following statements is true about these algorithms?
(a) Flooding-based and centralized systems can support much richer queries (regular expressions, wild-
cards) than routing-based systems.
(b) Routing-based systems are more scalable than flooding-based systems since they produce less traffic
per search.
(c) Routing-based systems ensure that a client finds the copy of a file that is closest to it in the network.

1
(d) Ring-based DHTs are not as flexible as other DHTs since they only allow routing in one dimension.

Solution: (a)(b)

3. Imagine a Chord system using 4-bit ids. Let there be 4 nodes participating with IDs 0, 3, 9, 11 and 12.
(a) Use the table below to fill in the finger table for node 0. Please assume clockwise data assignment.
ID pointed to Node storing ID

Solution:
ID pointed to Node storing ID
1 3
2 3
4 9
8 9

(b) Using the above Chord ring, what path would a request starting at node 0 take to find data item
12?

Solution: 0 → 9 → 11 → 12

4. Suppose you retrieve index.html from cnn.com and find that it has 3 embedded images that have been
akamaized. Assume that your browser does not use persistent connections and that your DNS cache is
empty. Assume that the only TTLs used for DNS are 1 day and 1 minute. In retrieving the 3 images
(not the html file), how many connections will your browser make to:
(a) the original content provider

Solution: 0

(b) the DNS root/gTLD server

Solution: 1 (to resolve akamai’s NS)

(c) the Akamai high-level DNS server

Solution: 1 (to a region)

Page 2
(d) the Akamai low-level

Solution: 1 (1 minute TTL sufficient for image retrieval)

(e) the closest Akamai server

Solution: 3 (1 per image)

5. Consider 10 flows with arrival rates of 1,2,...,10 Mbps that traverse a link of 50Mbps. Calculate the
max-min fair share on this link. What is the fair share if the link capacity is 60 Mbps?

Solution:

1. Flow 1 = 1 Mbps
2. Flow 2 = 2
3. Flow 3 = 3
4. Flow 4 = 4
5. Flow 5 = 5
6. Flow 6 = 6
7. Flow 7 = 7
8. Flow 8 = 7.33
9. Flow 9 = 7.33
10. Flow 10 = 7.33

If capacity is 60 Mbps, the capacity exceeds the sum of demands so

1. Flow 1 = 1 Mbps
2. Flow 2 = 2
3. Flow 3 = 3
4. Flow 4 = 4
5. Flow 5 = 5
6. Flow 6 = 6
7. Flow 7 = 7
8. Flow 8 = 8
9. Flow 9 = 9
10. Flow 10 = 10

6. Consider 10 wireless users associated with an access point, and they are sending data to the access point
using transmit rates of 1,2,...,10 Mbps, respectively.

Page 3
(a) Suppose all users are transmitting continuously with maximum frame size, e.g. 1500 bytes. Cal-
culate the effective data rate for each wireless user, you can ignore the protocol overhead. (Hint:
airwave is shared by all users and access point allocates equal link-layer throughput to every asso-
ciated user.)

Solution:
1
All users will have the same throughput of 1 1 1 M bps = 341.42Kbps
1 + 2 +...+ 10

(b) From the previous problem we can see that the effective data rate is greatly limited by the slow
users. Propose a simple idea to solve this problem (describe your idea, do not write a complete
solution).

Solution: A simple solution is to let wireless routers allocate equal air time (instead of equal
throughput) to all links.

7. Consider the following topology.

M B
Internet Network
A
A
(a) You want to deploy both a firewall and an NIDS, where do you want to place each of them (choose
from A and B)? Briefly explain your choice.

Solution: Firewall at A because it is fail-close. NIDS at B because it is fail-open.

(b) Suppose there is a malicious attacker M in the Internet, how to set the rule on the firewall to prevent
traffic from M (use the following table)?
Rule Dir Src Addr Src Port Dst Addr Dst Port
Ingress
Solution:
Rule Dir Src Addr Src Port Dst Addr Dst Port
Ingress in M’s addr any any any

(c) Suppose M knows the rule specified in (b), how can he evade such blocking, e.g. still be able to
send packets to A?

Solution: IP address spoofing.

(d) Traditional rules only inspect the IP headers. What is the limitation of this approach? Proxy-
based firewall is deployed where packet content is also inspected, what are the pros and cons of this
approach?

Page 4
Solution: The network is susceptible to higher-layer attacks, such as attacks to legitimate
services. The pros of packet content inspection include security, and the cons include high
inspection overhead.

Page 5
A Routing
1. For the network depicted below, circle the answers that list valid paths that packets may take under
valley free routing between a pair of clients.
0
1
00000000
111111111010
00000011
11111100
ISP Y
ISP A

0
1
00000000
111
0
111111 0
1

ISP Z
00000011
11111100
ISP X Legend
Peer Peer
1
0
0
1 1
0
0
1
111111
00000000
11 0
1
0
1
111111
00000000
11
0
1
0
1
Customer Provider
00000011
11111100 00000011
11111100 1111
0000
1
0
00
11
0
1
0
1
000011
00 Client / Stub network
1111
A. Client −→ ISP Z −→ ISP X −→ ISP A −→ Client
B. Client −→ ISP X −→ ISP Y −→ ISP A −→ ISP Z −→ Client
C. Client −→ ISP Y −→ ISP X −→ Client
D. Client −→ ISP Z −→ ISP A −→ ISP Y −→ Client
E. Client −→ ISP Z −→ ISP X −→ ISP Y −→ Client

Solution: Total: max 5 pts


(C)(3 pts) and (D)(3 pts) are correct paths.
3 pts deducted for each incorrect answer

Page 2
2. We discussed three different routing protocols: link state routing (LS), distance vector routing (DV),
and path vector routing (PV). Please answer the following questions by circling the protocol(s) for which
the claim applies:

LS, DV, PV - Requires a map of the complete topology

LS, DV, PV - Sends its routing table to its neighbors

LS, DV, PV - Requires flooding

LS, DV, PV - Suffers the count to infinity problem

LS, DV, PV - BGP is this type of routing protocol

Solution: (a) LS (b) DV,PV (c) LS (d) DV (e) PV

Page 3
B Multicast
3. The major use of multicast today is not on the wider Internet, but in the datacenter. It is used to
distribute information or files to only those nodes interested in the information. One application in
particular is used in a testbed called Emulab, which allows users to grab from 1 to 200 machines and run
programs on them. Emulab’s “frisbee” program distributes entire disk images (hundreds of MB each) to
each testbed machine when a user starts an experiment, so that the machines start from a fresh, known
operating system installation.
(a) Frisbee runs very quickly, transmitting at over 100Mbit/ sec. It could be quite bad if this multicast
traffic leaked out all over the Internet. What mechanism could its designers use to prevent this
high-rate multicast traffic from leaking out of their network onto the Internet, even if someone on
the Internet intentionally subscribed to it?

Solution: The designers should use TTL-scoped multicast. (We also accepted “use firewall
rules to block the multicast address at the border routers”, but this solution is not as robust
or convenient.)

(b) You recall from class that an alternative to native multicast is “application-layer” multicast, in which
hosts transmit to each other. One logical way to set up application-layer multicast for Frisbee would
be to use a distribution tree: the source sends to two nodes, 1 and 2. Each of these nodes sends to
two more nodes, and so on, and so on.
Assume that each node can send and receive at the same rate of R packets per second and can
forward a packet as soon as it receives it. Assume that the switch is not a bottleneck (it can
forward as many packets as the hosts can send).
Assume that there are N=128 nodes.
(a) How much more time, as a percentage (100%? 100000%?), will it take to send the disk images
to the nodes using application-layer multicast than native multicast?

Solution: Given the assumption we stated above (a node forwards a packet as soon as it
receives it), the answer is: It will take 200% of the time it would ordinarily take.
The sender now sends to two nodes. Therefore, it can only send at 50% of its normal
sending rate to each of those nodes. Those nodes transmit two packets out for each packet
they receive–but they only receive at 50% of their maximum traffic rate.
There is also a small additional delay from the time needed for the last packet to traverse
the 7 layers of the forwarding hierarchy, but this delay (milliseconds) is tiny compared to
the transmission time.
However: We were fairly flexible on grading this problem and also accepted the answer
700%, which would be correct iff a node could only send traffic after it received it. Well,
kind of—technically, since it would have to send two copies of the disk image, it would
really be 1400%, so we took that too.

(b) If the disk image is 100,000 packets in size, how many total packet transmissions will there
be using native multicast? Using application-layer multicast? Your answer doesn’t have to be
completely exact, but should be within a few percent.

Solution: Using native multicast, the source will send each packet exactly once. There
will be 100,000 packet transmissions.
Using application-layer multicast, each packet is sent using unicast. Therefore, each packet
must be transmitted in order to be received. There are 128 nodes that must receive the
packet, and therefore, there will be 128 ∗ 100, 000 total packet transmissions.

Page 4
(c) Again, with a disk image of 100,000 packets, how many total packet receptions will there be
using native? using application-layer?

Solution: Using both schemes, every node must receive every packet. There will therefore
be 128 ∗ 100, 000 total packet receptions regardless of the scheme.
(This illustrates the difference between native and application-layer multicast: In native,
there is one transmission but there are N receptions.)

(d) Name one advantage of native multicast and one advantage of application-layer multicast.

Solution: Native multicast requires fewer transmissions and is faster.


Application-layer multicast works in more heterogenous environments, because it doesn’t
depend on any particular support in switches and routers. It can also take advantage
of caching and retransmissions at the application layer, things that are fairly complex to
implement with native multicast.

Page 5
D IP Layer
5. Sally Student runs a large network at her house and wants to subnet it to separate her work computers
from the network that controls her toaster and fish tanks. She has purchased a NAT box, and divided
her network up as follows:
H2
H1
Subnet 3
Subnet 1
a
H1
b i o
R1 NAT Internet
H3
c
Subnet 2

H4
Her ISP has given her an IP address that she assigns to NAT-o (the outside or “o” interface on the NAT
box). Sally knows that RFC1918 specifies three different address ranges that she could use for private
addresses inside her home:
10.0.0.0 - 10.255.255.255 (10/8 prefix)
172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
(a) Your job is to assign addresses to the subnets, routers, and NAT box inside her house. Use addresses
from the 10.x netblock.
Subnet Number Netmask
Subnet 1
Subnet 2
Subnet 3
Interface IP Address
H1
H2
H3
H4
R1a
R1b
R1c
NAT-i
Solution: There are many solutions, here is one:
Subnet Number Netmask
Subnet 1 10.0.1.0 255.255.255.0
Subnet 2 10.0.2.0 255.255.255.0
Subnet 3 10.0.3.0 255.255.255.0

Page 8
Interface IP Address
H1 10.0.1.1
H2 10.0.1.2
H3 10.0.2.1
H4 10.0.2.2
R1a 10.0.1.3
R1b 10.0.3.1
R1c 10.0.2.3
NAT-i 10.0.3.2
Note that broadcast addresses and network addresses can NOT be assigned to interfaces.

(b) Give one reason that wide-spread deployment of IPv6 would let Sally get rid of her NAT device.

Solution: IPv6 would allow Sally to place a virtually unlimited number of devices on her home
network without special IP address allocation from her provider.

(c) Give one reason that Sally might want to continue using her NAPT even if she could use IPv6.

Solution:
A NAPT provides a measure of security by not permitting unsolicited inbound connections.

(d) Assuming that the NAT box has no special support for any protocols, and merely translates TCP
and IP ports and addresses, give an example of an application that would not work through this
NAT, and very briefly explain why.

Solution: FTP would not work through this NAPT because it requires that the server open
a connection back to the client. (Passive mode FTP would work—it has the client open the
connection instead). Any protocol that embeds IP or TCP-layer information in the application
stream is likely to be broken by a basic NAT.

Page 9
6. The figure below shows how two private, physically disconnected IP networks are connected by an IP
tunnel. Neither network advertises routes so they are not reachable from the general Internet. For each
router interface, we show the IP address plus the datalink layer address (e.g., an IEEE 48-bit address
for Ethernet or virtual circuit identifier for ATM).
In the image below, let H1 be the host with MAC address 1 and H2 be the host with MAC address 12.

125.3.8.19 12.2.7.99 12.2.7.13 12.2.7.1 125.3.8.9 125.3.8.39


MAC 2 MAC 3 MAC 5 MAC 7 MAC 9 MAC 11
12.2.7.34 12.2.7.3 125.3.8.5
125.3.8.13 12.2.7.56 MAC 6 125.3.8.8
MAC 4 MAC 8 MAC 10 MAC 12
MAC 1

IP Tunnel H
R 1
H R R
R R
Ethernet 2
Framerelay 2 Ethernets
network
LAN A WAN LAN B

Page 11
A packet sent from H1 to R1 (the left most router) has the following contents:

Hdr Type Src Dest


Ethernet DL 1 DL 2
IP 125.3.8.13 125.3.8.19

Data

(a) Fill the table below with the header types and source/destination addresses for each layer 2 and
layer 3 header in packet 1 marked on the figure. If a header has no source and/or destination
address, please briefly explain what other information in the header is used to forward the packet.
The packet is in transit from H2 to H1. (Note that the table has more spaces for headers than you
will need.)
Hdr Type Src Dest

Data

Solution: There is an IP header (with the addresses of the source and destination) and a M
AC header with the MAC address of the source and destination on this network at location 1

Page 12
Hdr Src Dest

MAC 10 9
IP 125.3.8.8 125.3.8.13
...data...

(b) Same question for packet 2, which is in transit from H1 to H2.


Hdr Type Src Dest

Data

Solution: Again we have an IP header with the addresses of the source and destination. Th e
next header is the tunneling header with the IP addresses of the tunnel entry and exit. Sin ce the
packet is traveling over a framerelay network, the “destination” address i s a virtual connection

Page 13
Hdr Src Dest

identifier. There is no source address.


VC 1
IP 12.2.7.99 12.2.7.3
IP 125.3.8.13 125.3.8.8
...data...

Page 14
F Link Layer
9. Calculate the latency (from first bit sent to last bit received) for the following:
(a) A 10-Mbps link with a single store-and-forward switch in the path, and a packet size of 1024 bits.
Assume that each section of the link introduces a propogation delay of 10 microseconds, and that
the switch begins retransmitting immediately after it has finished receiving the packet.

Solution: To put the packet on the first link it will take:


1024bits
10−Mbps∗1,000,000bits/Mb = .1024ms
Then it will take another .01ms for the switch to finish receiving the packet for a total of .1124
ms. It will take another .1124 ms for the switch to send, and then for the destination to receive
all of the packet. The total is:
2 * .1124 ms = .2248 ms

(b) Same as (a) but with five switches

Solution: From (a) we know that each link section will take .1124 ms. The total time will be
6 * .1124 ms = .6744 ms

(c) Same as (a) but assume the switch implements cut-through switching: it is able to begin retrans-
mitting the packet after the first 128 bits have been received.

Solution: To begin we can calculate the time it will take to send the first 128 bits:
128
10−Mbps∗1,000,000bits/Mb = .0128ms
Then, .01 ms later, the switch can start sending the packet. It will take .1024 ms (from (a)) to
put the entire packet on the wire. Then it will take .01 ms for the destination to finish receiving
the entire packet:
.0128ms + .01ms + .1024ms + .01ms = .1352ms

Page 17
10. (a) Given the Ethernet LAN shown in the figure below, indicate which ports are not selected (and
therefore disabled) by the spanning tree algorithm. The hosts in the figure are labeled A-J and the
bridges in the figure are labeled B1-B7. Hub Bi has an ID of i which is used as the tie breaker.
A B

B7
B5
C
B2
F

D
B1

B3

G H

B4 J
B6

Solution: The following ports are not selected: B2-A B5-B B5-F B6-I

In the above picture mark the paths that would be used for sending data over the following routes
(make sure to label the paths):
(a) Host A to Host H
(b) Host I to Host J
(c) Host D to Host F

Solution: Each solution lists the bridges that the data would go through
(a) B7, B1, B3
(b) B4, B3, B6
(c) B3

(d) Consider using the same network topology, but replace the bridges with routers using OSPF. Assume
all link costs are equal and use the router’s ID as a tie breaker. The hosts are nodes or subnets that
are connected to multiple routers. On the picture below, mark (and label) the paths that would be
taken to transmit data between the following hosts.
(a) Host A to Host H
(b) Host I to Host J
(c) Host D to Host F

Solution: Each solution lists the bridges that the data would go through
(a) B2, B3

(b) B6
(c) B3

Page 18
A B

B7
B5
C
B2
F

D
B1

B3

G H

B4 J
B6

(d) All three transfers are occuring at the same time and each host is sending as much data as it can.
The bandwidth and latency on all the links are the same. If two transfers use the same link, they
will share the bandwidth equally. A bridge can carry any amount of traffic, only individual links
are limited in their capacity. How much capacity will each of the 3 transfers get, in terms of the
fraction of the capacity C of a single link:

When the network is using OSPF to create its topology:

Host A to host H:

Host I to host J:

Host D to host F:

Solution: Host A to host H: C/2 Host I to host J: C Host D to host F: C/2

When the network is using Ethernet and spanning tree to create its topology:

Host A to host H:

Host I to host J:

Host D to host F:

Solution: Host A to host H: C/2 Host I to host J: C/2 Host D to host F: C

Page 19
11. Suppose Ethernet was the only existing LAN technology, so every host in the Internet was part of a
local Ethernet and therefore had a globally unique Ethernet address. Would you now recommend to get
rid of IP addresses by simply using Ethernet addresses instead of IP addresses? What about the other
way around, why do we not simply assign network adapters IP addresses instead of Ethernet addresses
so we don’t have to deal with both, IP and Ethernet addresses?

Solution: We still want to keep IP addresses because they are assigned in a hierarchical fashion
which allows hierarchical routing. Ethernet addresses don’t have a structure that can be used for
hierarchical routing.
We also don’t want to replace Ethernet address by IP addresses, since that would mean hardcoding
the IP address in a machine. Therefore, we couldn’t do things like dynamically reassigning IP
addresses (DHCP) and it would also create problems if a host moves to a new location. Also,
Ethernet addresses are longer than IP addresses, so IP addresses are more likely to be used up.

Page 20
C IP Layer
7. Sally Student runs a large network at her house and wants to subnet it to separate her work computers
from the network that controls her toaster and fish tanks. She has purchased a NAT box, and divided
her network up as follows:
H2
H1
Subnet 3
Subnet 1
a
H1
b i o
R1 NAT Internet
H3
c
Subnet 2

H4
Her ISP has given her an IP address that she assigns to NAT-o (the outside or “o” interface on the NAT
box). Sally knows that RFC1918 specifies three different address ranges that she could use for private
addresses inside her home:
10.0.0.0 - 10.255.255.255 (10/8 prefix)
172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
(a) Your job is to assign addresses to the subnets, routers, and NAT box inside her house. Use addresses
from the 10.x netblock.
Subnet Number Netmask
Subnet 1
Subnet 2
Subnet 3
Interface IP Address
H1
H2
H3
H4
R1a
R1b
R1c
NAT-i
Solution: There are many solutions, here is one:
Subnet Number Netmask
Subnet 1 10.0.1.0 255.255.255.0
Subnet 2 10.0.2.0 255.255.255.0
Subnet 3 10.0.3.0 255.255.255.0

Page 5
Interface IP Address
H1 10.0.1.1
H2 10.0.1.2
H3 10.0.2.1
H4 10.0.2.2
R1a 10.0.1.3
R1b 10.0.3.1
R1c 10.0.2.3
NAT-i 10.0.3.2
Note that broadcast addresses and network addresses can NOT be assigned to interfaces.

(b) Give one reason that wide-spread deployment of IPv6 would let Sally get rid of her NAT device.

Solution: IPv6 would allow Sally to place a virtually unlimited number of devices on her home
network without special IP address allocation from her provider.

(c) Give one reason that Sally might want to continue using her NAPT even if she could use IPv6.

Solution:
A NAPT provides a measure of security by not permitting unsolicited inbound connections.

(d) Assuming that the NAT box has no special support for any protocols, and merely translates TCP
and IP ports and addresses, give an example of an application that would not work through this
NAT, and very briefly explain why.

Solution: FTP would not work through this NAPT because it requires that the server open
a connection back to the client. (Passive mode FTP would work—it has the client open the
connection instead). Any protocol that embeds IP or TCP-layer information in the application
stream is likely to be broken by a basic NAT.

Page 6
F Wireless Networks
11. Consider the following wireless network arrangement. Nodes connected with a line can receive transmis-
sions from one another; unconnected nodes are too far to communicate. Link strengths are proportional
to the length of the line.

(a) Recall that a hidden terminal problem can lead to unexpected collisions. What are some nodes
which might encounter a hidden terminal issue in transmitting?

Solution: Any two nodes which connect to a common node but do not connect to one another
are hidden terminals; A-C-F, E-F-D, and so on.

(b) What are two pairs of nodes which should be able to transmit to one another simultaneously, but
cannot, because of an exposed terminal problem?

Solution: C to A and B to D, for example: C and B can see each other, but not A-B or C-D.

(c) Suppose this is an ad-hoc network using dynamic source routing. Node A wishes to send a packet to
node D. All nodes have empty route caches; therefore, the first thing to happen is a route discovery
step. How does route discovery in a DSR network propagate through the network?

Solution: A will send an RR packet to E and C, looking to reach D; it will then be rebroadcast
by B and F, and then reach D. Once a route is found, a reply will proagate from D back to
A, and intermediate nodes will add this information to their route caches. Then, A can send a
suitably addressed packet across the network.

(d) The DSR algorithm presented in lecture does not specify what should occur if two routes with the
same number of hops exist. Suppose we change the discovery algorithm such that when a node
receives a route request, it waits very briefly (for just enough time to receive another RR from
another link, if any is arriving near-simultaneously) and then determines which route to offer when
it rebroadcasts or replies to the request. Do not consider collisions; assume all packets are properly
received.
How might a node choose ‘optimally’ which request to forward? What does this optimize for? What
route would your algorithm decide upon to route a message from A to D?

Page 11
Solution: Only forward the “strongest” request. This should mean that the most direct path
will be taken. In the above network, F will forward from C, not E; D will choose the path via
B and C.

Page 12
D DNS
3. For answering the following question, consider the following name servers and the entries their translation
tables contain:
local name server

Name Value Type Class


com ns1.nstld.com NS IN
ns1.nstld.com 192.5.6.32 A IN

name server ns1.nstld.com

Name Value Type Class


funsite.com dns.funsite.com NS IN
dns.funsite.com 128.112.129.15 A IN

name server dns.funsite.com

Name Value Type Class


lotsafun.funsite.com 128.112.136.72 A IN
manatee.funsite.com 128. 112.155.166 A IN

(a) Suppose client1 queries the local name server for lotsafun.funsite.com. The local name server will
recursively resolve the request and cache the results with a TTL of 10 minutes. Make a diagram of
what will happen involving the client and the three nameservers, and writing down all DNS requests
and responses.

Page 5
(b) DNS generally uses UDP, and each request includes a transaction ID. After issuing a request, a
name server listens on the UDP socket for a response that matches the transaction ID. Danny has
noticed that it takes some time for the local name server to resolve his requests, and can’t resist
the temptation to cause trouble. He wants to send a single request for lotsafun.funsite.com to his
local name server, and then trick it into storing (and returning to him) an incorrect translation. If
Danny is willing to spoof a source address and blast traffic at his local name server, how might he
pull this off?

Solution: The DNS packet the isp asks for can come from Danny. He asks to resolve page,
before the websites DNS server can responds, he responds as though he is that website’s DNS
server and gives an incorrect result, the actual result from the isp server is thrown out by the
isp server. must send a lot of requests and responses to the isp server to get a transaction id
match.

(c) Assume for the next part that each name server can connect to the client or any other nameserver
with RTT = 1.6s and bandwidth 100Mbps. Also, let all DNS packets have size 1 Kbit. For this
problem assume the local server has the result for dns.funsite.com from NS1 cached. There are
65536 possible transaction IDs that can be associated with a request, and suppose that the local
nameserver always choses from among 100 UDP ports to listen for a response. Suppose that both
the transaction ID and the UDP port are chosen at random. Given that Danny sends packets as
fast as possible to the local name server, what is the probablity he will trick it?

Solution: Danny can send at 105 kb/s for 1.6 seconds so he can send 160,000 Kb. So he has
160,000 chances to compromise the server in the 1.6 seconds, 160000/(100 ∗ 65536) = .02.

Page 6
E Routing
4. Switches and routers are both responsible for forwarding data between networks and network segments,
but they operate on different layers and are as a result very different. Please discuss the following
differences:
(a) How do the addresses differ?

Solution: Hierarchical IP addresses versus flat (with respect to address look up) 48 bit IEEE
addresses.

(b) How does the structure of the forwarding tables differ?

Solution: Switches use a simple look up of the flat addresses, e.g. using a content addressable
memory. Routers need to deal with CIDR address look up, which usually uses tree.

(c) What is different about how the forwarding tables are filled in?

Solution: Routers use full blown routing protocols such OSPF or BGP. Switches uses a spanning
tree protocol.

Page 7
5. For this problem, consider the following network topology:

A B D

F G
C E

Suppose that the routers are running RIP, and are all turned on simultaneously. Recall that in RIP, the
weight assigned to each link is one. You can also assume that if RIP identifies multiple paths of equal cost,
it picks one randomly.
The initial routing table at node A is:

Destination Cost Next Hop


B 1 B
C 1 C
D ∞ —
E ∞ —
F ∞ —
G ∞ —

Fill in the following tables to show the initial routing table at node F:

Destination Cost Next Hop


A
B
C
D
E
G
Solution: 3pts, -1 per mistake
Destination Cost Next Hop
A ∞ —
B ∞ —
C ∞ —
D 1 D
E 1 E
G 1 G

Page 8
6. Now show the contents of the routing table after each iteration of the algorithm:
(a) After iteration 1:

Destination Cost Next Hop


A
B
C
D
E
G
Solution: 4pts, -1 per mistake
Destination Cost Next Hop
A ∞
B 2 D or E
C 2 E
D 1 D
E 1 E
G 1 G

(b) After iteration 2:

Destination Cost Next Hop


A
B
C
D
E
G
Solution: 4pts, -1 per mistake
Destination Cost Next Hop
A 3 D or E
B 2 D or E
C 2 E
D 1 D
E 1 E
G 1 G

Page 9
7. In some failure situations, the administrator notices that it takes an exceptionally long time for the
routing protocol to stabilize in this network.
(a) What problem with RIP is the cause?

Solution: 3pts
Count to infinity

(b) The administrator is told that BGP does not suffer from this problem. What prevents BGP from
having this problem?

Solution: 2pts
Path vector - passing path info with distance eliminates loops

Page 10
H Link Layer

I Collision Detection
10. The first random media access control (MAC) protocol developed in 1970 was the ALOHA protocol
developed for wireless networks, which was a major building block for the Ethernet protocol. ALOHA’s
basic “collision” detection technique was that, after every transmission, the transmitter waited for an
acknowledgement packet from the receiver to know that the transmission was successful. If an ACK was
not received within a time period, the sender decided to retransmit the packet. Answer the following
short questions.

(a) After collision detection was developed for Ethernet, its technique was not adopted by wireless
networks. Why is it not possible to achieve true collision detection in wireless networks?

Solution: It is not possible due to the hardware. The transmission power from the sender is
so great that it cannot detect another lower powered transmission at its receiver.

(b) Finally, in wireless and wired protocols alike, a backoff occurs once a collision is detected. What is
the purpose of the backoff, and why is the backoff value chosen randomly?

Solution: The purpose of the backoff and random value is that so the two senders do not
collide again by immediately transmitting again at the same time. Also, by choosing random
backoff values we introduce some amount of fairness in the network.

Page 15
B Link Layer: Yesterday and Today
7. Aloha was the first random medium access control protocol. It worked by having nodes transmit when-
ever they were ready and then wait for an acknowledgment packet from the destination to confirm
successful reception. If no acknowledgment was heard within a certain period, the source assumed a
collision happened and tried resending after a random delay.
The Ethernet protocol, CSMA/CD can be seen as an evolution of the original Aloha design. For each
of its two features below, give a very brief explanation of what it is and why it is an improvement over
aloha.
(a) Carrier sense

Solution: Carrier sense is to listen for activity in the channel. In Aloha, nodes transmit
immediately when they are ready to send. In CSMA/CD, carrier sense is used and only if the
medium is idle do we transmit, therefore avoiding many unnecessary collisions.

(b) Collision detection

Solution: Collision detection is the method of detecting if two messages were sent at the
same time, thus preventing proper communication. In CSMA/CD there are no timeouts or
acknowledgments. Instead nodes constantly monitor the medium and send a jam sequence as
soon as a collision is detected so that everyone learns about it as soon as possible.

8. The original Ethernet used 8 bit addresses and even today, LANs rarely have more than a few hundred
nodes, so you might think something like 16 bits would be more than sufficient for a physical address.
Give one significant reason that Ethernet uses 48 bit physical addresses despite the additional overhead?

Solution: 48 bits allows the addresses to be unique, this means:

• no configuration necessary for hooking up a new node;


• separation of routing from addressing;

• a basis for unique identification of files, programs and other objects on the networked hosts.

Also, the leftovers are used for multicast, etc.

Page 5
9. Oceanic Airlines has just built a new office on a desert island and you are hired to help design its local
area network. The chosen technology is Ethernet, with copper wires for a propagation speed of 1.8 ∗ 108
m/s and a length of 600m.
(a) Assuming the employes would be happy with 100 Mbps, how big must your packets be to ensure
perfect collision detection? Justify by showing your calculations.

Solution: 2 x propagation delay = 2 × 600m/1.8 × 108 m/s = 6.667 × 10−6 s


At 100 Mbps, how many bits do we send in 6.667 × 10−6 s? We send 6.667 × 10−6 × 1 × 108 =
667bits

(b) Somehow there aren’t many clients on a desert island and employees are spending all of their time
watching videos on You Tube, so you need to upgrade to 1 Gbps. What are the two ways you can
change either the network topology, network protocol, or both to handle this new speed?

Solution: Make packets ten times bigger (6670 bits), or the network ten times smaller (60 m).

(c) There is a malfunctioning machine in your 1 Gbps network that thinks the maximum packet size
is 100 bits and starts sending packets immediately after seeing the 100th bit of a packet, causing
collisions. Your network interface card reports this collision after 700 bits have been sent. Can you
identify the malfunctioning node by computing its relative distance to your own machine?

Solution: 700bits = 2x + 100 ≡ x = 300


prop delay = 300bits/109 bits/s = 3 × 10− 7s
speed = 1.8 × 108 m/s
distance = prop delay × speed = 3 × 10− 7 × 1.8 × 108 = 54m

Page 6
C BGP relationships
Consider the network depicted and answer the questions below.

10. Which paths may packets take between a pair of end-hosts considering Internet economics? Circle valid
and invalid for the paths and, if it is invalid, give a short statement why.

Valid OR Invalid x1 → AS X → AS Q → AS P → AS A → a1
why?

Solution: F - goes over a peering link from AS Q to AS P before going to P ’s provider,


which violates valley-free routing (AS P is losing in the process).

Valid OR Invalid r1 → AS R → AS Q → AS X → x1
why?

Solution: T

Valid OR Invalid y1 → AS Y → AS R → AS B → AS A → a1
why?

Page 7
Solution: T

Valid OR Invalid y1 → AS Y → AS R → AS Q → AS P → p1
why?

Solution: F - goes through 2 peering hops, which violates valley-free routing (AS Q is
losing in the process).

Solution:
2 points for each correct answer with explanation. 1 point deducted if explanation is not clear or
incorrect. Using (-1,0,+1) labeling for customer, peer and provider links was accepted if sufficient
explanation was given.

11. Suppose AS’s Q and R begin fighting


(a) Using only BGP, is it possible for AS Q to implement a policy stating that traffic outbound from
AS Q should not cross AS R? Why or why not?

Solution: Yes, AS Q can only choose routes in which AS R does not appear in the AS PATH
attribute.

(b) Using only BGP, is it possible for AS R to implement a policy stating that it doesn’t want to carry
traffic from Q to AS R’s customers? Why or why not?

Solution: No, it needs to provide service to customers and, therefore, announce reachability
to its customers to its BGP neighbors. At that point, AS Q may receive an announcement from
one its neighbors of reachability through AS R.

Solution:
2 points for each correct answer with explanation. 1 point deducted if explanation is not clear or
incorrect.

Page 8
D Repeaters, Bridges, Routers and Tunneling

12. In the above topology, Hn represents a host machine and A, B, C, D are repeaters/bridges/routers. The
edges represent Ethernet cabling between the devices.

(a) Suppose A, B, C and D are repeaters (hubs). Assuming that the sender does not hear the packet
it sends, list the hosts that can overhear a packet sent from H1 destined to H4.

Solution: H2, H3, H4, H5, H6

(b) If A is a switch (learning bridge) which knows where the hosts are (i.e. has a filled in bridging
table), and B, C and D are repeaters (hubs), list the hosts that can overhear a packet sent from H1
destined to H4.

Solution: H2, H3, H4

(c) If A, B, C and D are learning bridges which know about the hosts’ locations, which hosts can hear
the packet from H1 to H4?

Solution: H4

Solution: 2 pts each. partially correct solutions got 1 point

Page 9
13. For this question, we use the following notation. The IP address and link-layer address of a node is IP-
<name> and MAC-<name> (e.g. IP-H1 is the IP address of H1 and MAC-A is the link-layer address
of A).
In a setting where A, B, C and D are all hubs, the table below shows the headers for a packet sent from
H1 to H4 as it traverses the link B-A. Answer the remaining questions using the same notation.
Header Type Src Addr Dest Addr
link-layer MAC-H1 MAC-H4
IP IP-H1 IP-H4

(a) In a setting where A is a switch and B, C and D are repeaters (hubs), show the network and
link-layer headers for the packet sent from H1 to H4 (outermost header first) as it traverses link
B-A.

Header Type Src Addr Dest Addr


link-layer MAC-H1 MAC-H4
IP IP-H1 IP-H4

(b) Suppose A, B, C and D are routers. show the network and link-layer headers for a packet sent from
H1 to H4 (outermost header first) as it traverses link B-A.

Header Type Src Addr Dest Addr


link-layer MAC-B MAC-A
IP IP-H1 IP-H4

(c) Suppose A, B, C and D are routers, and there is an IP-in-IP tunnel from B to C. Show all network
and link-layer header(s) for a packet sent from H1 to H4 (outermost header first) as it traverses link
B-A. (hint: remember to show any encapsulated headers)

Header Type Src Addr Dest Addr


link-layer MAC-B MAC-A
IP IP-B IP-C
IP IP-H1 IP-H4

Solution: 4 points each -0.5 for each incorrect cell (.5’s are floored down) -2 for missing row
-1 for additional row

Page 10
4. (30 pts) Fair Queuing.
Answer the following questions about the network of four routers below. Each link has capacity of 1
Mbps. You can assume there is no contention on the access links, or for router backplane resources;
i.e., the only constraints are the link capacities between routers. There are four flows in the network,
labeled F 1 . . . F 4, that traverse the routers indicated. F 4 shares links with every other flow, traversing
R3 → R1 → R2 → R4.

F2  

R1   R2  

F1   F4   F3  

R3   R4  

a) Assume each router implements FIFO queuing. If each flow consists of an identical, 1-Mbps
constant bit rate UDP flow with equal packet sizes, what will the resulting rate be for each flow?
You can assume that FIFO drops packets with uniform probability.

F 1 and F 4 compete at R3 1:1, giving each 1/2 Mbps. F 4 then competes at R1 with F 2 at
1/2:1, giving F 2 2/3 Mbps and F 4 1/3 Mbps. Hence, F 4 competes at R2 with F 3 at 1/3:1,
resulting in a final allocation for F 3 of 3/4 Mbps and 1/4 Mbps for F 4.

b) Now consider the case where all routers implement fair queuing. What would be the throughput
of each flow now?

Every flow’s fair share at each link is 1/2 Mbps. F 4 will always be at least 1/2 Mbps when
it competes with each other flow, so all flows get precisely their fair share: 1/2 Mbps each.

c) Finally, assume all routers implement WFQ, and each flow is assigned a weight equal to its
number (i.e., flow F 4 gets weight 4). What are the resulting throughputs?

F 1 and F 4 compete 1:4 at R3, giving F 1 1/5 Mbps and F 4 4/5 Mbps. F 4 then competes
with F 2 at 4:2, so F 2’s fair share is 1/3 Mbps, giving F 4 2/3 Mbps. Finally, F 4 competes
with F 3 at 4:3, so F 3’s fair share is 3/7 Mbps, resulting in a final allocation for F 4 of 4/7
Mbps.

5
5. (30 pts) Routing & Token buckets.

a) Consider the network of five routers below, with edge weights labeled.

6  
R1   R2  

2   1   2   1  

4   3  
R3   R4   R5  

Show the step-by-step operation of Dijkstra’s algorithm for R3 using the table below.

Step Confirmed Tentative Comments


1 (R3, 0 , -)

2 (R3, 0 , -) (R1, 2, R1) (R4, 4, R4)

3 (R3, 0 , -) (R1, 2, R1) (R4, 4, R4)

4 (R3, 0 , -) (R1, 2, R1) (R4, 3, R1) (R2, 8, R1) It is cheaper to reach R4 through R1

5 (R3, 0 , -) (R1, 2, R1) (R2, 8, R1)


(R4, 3, R1)
6 (R3, 0 , -) (R1, 2, R1) (R2, 5, R1) (R5, 6, R1) It is cheaper to reach R2 via R4
(R4, 3, R1)
7 (R3, 0 , -) (R1, 2, R1) (R5, 6, R1)
(R4, 3, R1) (R2, 5, R1)
8 (R3, 0 , -) (R1, 2, R1) (R5, 6, R1) R5 is the same cost through R2 or R4
(R4, 3, R1) (R2, 5, R1)
9 (R3, 0 , -) (R1, 2, R1) Done.
(R4, 3, R1) (R2, 5, R1)
(R5, 6, R1)

6
b) Now consider a Bellman-Ford-based distance-vector protocol that uses split horizon and poison
reverse. Assume that the protocol has converged, and then node R5 fails. Will the protocol
reconverge? If so, show the sequence of updates that result. (After each update, show the
nexthop and cost for R5 as seen by each of the remaining routers.) If not, explain why not.

This will not converge, because the topology contains a cycle of three routers (e.g., R1, R3, R4)
where only one is directly connected to the failed node, R5. (In fact, when analyzing this
problem, you can safely remove R2 from the network as no router will ever use it as a nex-
thop for any other.) The remaining subset of the network looks just like the case on Slide
17 in lecture 13. Hence, the routers will count to infinity because they each only poison one
of the others at a time.

c) Consider a token bucket with maximum rate R = 20 Mbps. Suppose we want to make sure the
maximum rate can only be sent for at most 5 seconds at a time, and at most 150 Mb can be sent
over any 10-second window. Compute the required values for the token refresh rate, r, and the
bucket depth, b.

If we send the maximum rate for 5 seconds, we send 20 ∗ 5 = 100 Mb. We can only send
150 Mb in any 10-second window, including those we send at max rate, so 150 − 100 = 50
Mb, which we can send in the remaining 5 seconds, so r = 50/5 = 10 Mbps. Now, in order
to ensure the bucket has enough tokens to sustain a 5-second burst at 20 Mbps, we require
b = (R − r) ∗ 5 = (20 − 10) ∗ 5 = 50 Mb.

7
6. (30 pts) TCP congestion control.

a) (15 pts) Consider a TCP Reno (i.e., one that implements fast retransmit and recovery) flow that
has exactly 50 segments to send. Assume that during the transmission, exactly four packets
are lost: the 4th, 5th, 22nd, and 48th; no other losses occur. Using the graph below, plot the
evolution of the congestion window as each segment is sent. You may measure cwnd and time
in whatever units you find convenient. (Do not inflate the window due to duplicate ACKs.)

43,44,45,46,47,48,49  

20,21,22,23,24,25   37,38,39,40,41,42  

15,16,17,18,19  
32,33,34,35,36  

cwnd   4,5,6,7   11,12,13,14  


28,29,30,31  

8,9,10  
22,  26,  27  

2,3   5,6   50  

1   4   48  

Time  (RTTs)  

b) (10 pts) Label your plot above indicating the regions where slowstart, timeout, congestion avoid-
ance, and fast retransmit occur.

Timeouts, shown in red, occur after the loss of segments 4, 5, and 48. Slowstart periods,
depicted in blue above, are until the first loss, and one RTT after each timeout. A fast
retransmit of segment 22 is highlighted in yellow. Everything else is congestion avoidance.
(Note I picked 2 RTTs for timeout value, you could use anything 1 RTT or greater.)

c) (5 pts) Give one reason why TCP performs poorly when traversing overflowing FIFO queues,
and explain how RED attempts to address the issue.

TCP flows are bursty, so when they encounter a full FIFO buffer, they will experience large
numbers of losses in a window. RED spreads losses out. Also, TCP doesn’t realize there’s
congestion until the queue is full, but RED will signal congestion earlier by dropping before
the queue fills.

8
Exercise 3
Answers for each sub question:

1. subnets:
Department name Subnet Number Subnet Mask
A 137.110.0.0 255.255.255.128
B 137.110.0.128 255.255.255.128
C 137.110.1.0 255.255.255.192
D 137.110.1.64 255.255.255.192
E 137.110.2.0 255.255.254.0
2. B:
Subnet Number Subnet Mask Next Hop
137.110.0.0 255.255.255.128 Router A
137.110.0.128 255.255.255.128 Interface 0
default Router C
Note here that the only real entries needed are for A and B’s subnets - everything else,
including traffic to the rest of the internet, flows through C, and thus doesn’t need a
specific route.
F:
Subnet Number Subnet Mask Next Hop
137.110.0.0 255.255.255.0 Router C
137.110.1.0 255.255.255.192 Router C
Here, the routes for A and B are
137.110.1.64 255.255.255.192 Router D
137.110.2.0 255.255.254.0 Router D
default Interface 0
merged into the first entry - since they occupy the “bottom” and “top” halves of the
137.110.0.0/24 space and are addressed through the same router, they can be merged
into one entry. This is not required for full credit.

3. Subnets A and B can grow from 100 to 126 nodes. Subnets C and D can grow from 40
to 62 nodes. Subnet E can grow from 400 to 510 nodes. As all address space has been
allocated so far from low to high, all addresses from 137.110.4.0 to 137.110.255.254
are available. A new large department could be allocated at 137.110.4.0. Smaller
departments could also be allocated starting at 137.110.4.0, and two small departments
could also fill the two available 62 address blocks between subnets D and E.

3
Data 1 Data 1

Data 2 Data 2

Ack 1 Ack 1

Ack 2 Ack 2

Data 3 Data 3

Data 4 Data 4

Ack 3

Ack 2 Ack 4

Timeout: Data 3 Timeout: Data 3


Timeout: Data 4
Data 5
Data 6h

Ack 4 Ack 4

Ack 4 Ack 5

Ack 6

Data 5

Data 6h

Ack 5

Ack 6

4
Homework 3

1 DNS
Suppose you have a Host C, a local name server L, and authoritative name servers
Aroot , Acom , and Agoogle.com , where the naming convention Ax means that the name
server knows about the name zone x. Ax is a variable and NOT a hostname. Aroot is a
root name server known to L, with IP address 198.41.0.4. Assume that all name servers
initially have nothing in their caches.

a) Using the resource records below, provide the hostnames and IP addresses for
Acom and Agoogle.com
b) List the sequence of DNS queries and corresponding resource records that are
exchanged when C wants to lookup the address for www.google.com. When a
name server Ax contacts Ay , please specify the IP address for Ay . The following
represents the level of detail we are looking for:
i) Ax contacts Ay at 1.2.3.4 to resolve www.foobar.com
ii) Ay returns resource records R1 , R2 , . . . , Rn .
c) Client C performs a lookup for mail.google.com immediately after the previous
request. Assume all records have long TTLs. List the sequence of DNS queries
and corresponding resource records exchanged during the lookup.

1
Name Server Variable Resource Record
Aroot {com, a.gtld-servers.net, NS, IN}
Aroot {a.gtld-servers.net, 192.5.6.30, A, IN}
Acom {google.com, ns1.google.com, NS, IN}
Acom {ns1.google.com, 216.239.32.10, A, IN}
Agoogle.com {www.google.com, 66.102.7.104, A, IN}
Agoogle.com {mail.google.com, 66.102.7.83, A, IN}

Answer
a)
Acom : hostname=a.gtld-servers.net, IP address=192.5.6.30
Agoogle.com : hostname=ns1.google.com, IP address=216.239.32.10

Notes: Many people missed these because they assumed that the hostnames and IP
addresses merely corresponded to the resource record listed next to the variable.

b)
1) C queries L to resolve www.google.com
2) L queries Aroot at 198.41.0.4 to resolve www.google.com.
3) Aroot returns {com, a.gtld-servers.net, NS, IN} and {a.gtld-servers.net, 192.5.6.30,
A, IN}.
4) L queries Acom at 192.5.6.30 to resolve www.google.com
5) Acom returns {google.com, ns1.google.com, NS, IN} and {ns1.google.com, 216.239.32.10,
A, IN}
6) L queries Agoogle.com at 216.239.32.10 to resolve www.google.com
7) Agoogle.com returns {www.google.com, 66.102.7.83, A, IN}
8) L returns 66.102.7.83 to C.

c)
1) C queries L to resolve mail.google.com
2) L queries Agoogle.com at 216.239.32.10
3) Agoogle.com returns {mail.google.com, 66.102.7.104, A, IN}
4) L returns 66.102.7.104 to C.

2 TCP-like Design
NASA has built a series of satellites to orbit the Earth, except they lack the requisite
knowledge to design a communication protocol. They task you with designing a reli-
able, sliding window, bytestream protcol similar to TCP for communication over a link
with a bandwidth of 1 Gbps, an RTT of 384 ms, and a maximum segment lifetime of

2
15 sec. The protocol will not include a window scaling option.
a) How many bits wide should you make the AdvertisedWindow and SequenceNum
fields? Explain why you select your values
b) The person in charge of the program scoffs at your suggestions, and instead
wishes to use an AdvertisedWindow of 16 bits. Explain why this is problematic. c)
Suppose you settle on using TCP as your communication protocol. Two satellites, S1
and S2 want to communicate with a third satellite. Both S1 and S2 are in the Additive
Increase, Multiplicative Decrease (AIMD) phases of their transmissions, but S2 has a
much higher RTT than S1 . As such, you observe that S2 is not receiving its fair share
of the bandwidth. Explain how, under AIMD, the TCP congestion window grows with
respect to the RTT. Using that intuition, explain why the bandwidth is not being shared
fairly between S1 and S2 .

Answer
a)
To fully utilize the network, the AdvertisedWindow needs to be larger than the De-
lay*Bandwidth.

AdvertisedW indow ≥Delay ∗ Bandiwidth


= 384ms ∗ 1Gbps
= 48MB
= 50, 331, 648 bytes

Since 225 = 33, 554, 432 and 226 = 67, 108, 864, the AdvertisedWindow must be 26
bits.

SequenceNum must not wrap around before any delayed segments have left the net-
work. Presumably, this occurs within the maximum segment lifetime. Thus, the Se-
quenceNum must be larger than the MSS * Bandwidth.

SequenceN um ≥M SS ∗ Bandiwidth
= 15sec ∗ 1Gbps
= 1920MB
= 2, 013, 265, 920 bytes

Since 230 = 1, 073, 741, 824 and 231 = 2, 147, 483, 648, the SequenceNum must
be 31 bits.

Notes: Many people got the correct justification, but forgot to convert the bits to bytes.

b)
The AdvertisedWindow is smaller than Delay* Bandwidth; thus, it is limiting the effec-
tive bandwidth. Only an AdvertisedWindow worth of data can be transferred during a

3
single RTT. The effective bandwidth is

Ef f ectiveBandwidth = AdvertisedW indow/RT T


= 216 bytes/384 ms
= 166.67 KB/sec
= 1.30207825 Mbits/sec

c)
With the AIMD mechanism, the TCP congestion window increases by 1 for each RTT.
A flow with a longer RTT needs more time to increase its congestion window size,
compared to a flow with a short RTT. The flow with the longer RTT always has a
smaller congestion window size and receives less bandwidth.

4
3 TCP/Congestion Control

45

40

35
cwnd size (segments)

30

25

20

15

10

0
0 5 10 15 20 25
Number of RTTs

Assume TCP Reno (meaning Fast Retransmit and Fast Recovery) is the protocol ex-
periencing the behavior shown above. Assume that the TCP flow has been operating
for some time, meaning that the number of RTTs shown are with respect to when you
started observing the flow’s behavior.
a) Identify the time periods when TCP slow start is operating.
b) Identify the time periods when TCP congestion avoidance is operating (AIMD).
c) After the 14th RTT, is the segment loss detected by a triple duplicate ACK or by
a timeout?
d) What is the initial value of ssthreshold, before the first congestion avoidance
interval?
e) What is the value of ssthreshold at the 19th RTT?
f) What is the value of ssthreshold at the 24th RTT?
g) Assuming a packet loss is detected after the 25th RTT by the receipt of a triple
duplicate ACK, what will be the values of the congesion-window size and of
ssthreshold?

Answer
a) 1-6, 22-25
b) 6-22 (or 19, if you consider 20-22 a“timeout” phase)
c) Duplicate Acknowledgment. If a timeout happened, cwnd would drop to 1
d) 32. At 32, the flow exits slow start and proceeds to AIMD.

5
e) 20. At a cwnd size of 40, the cwnd is halved to 20 and the ssthreshold is set to
20.
f) 12, At a cwnd size of 24, a timeout occurs. ssthreshold is set to half of 24 (12),
and the cwnd size drops to 1.
g) 4,4. The triple dup ack causes the ssthreshold to be set to half the value of cwnd,
which was previously 8 at the conclusion of the 25th RTT. Due to fast recovery,
the cwnd is set to 4, or 7 if you considered inflation.

Notes: For part a), I wasn’t too strict about the inclusive vs exclusive ranges. For part
b), I also accepted 19 as an upper range. Most people who lost points on this problem
missed part g). It looked like people assumed the cwnd kept growing. However, part
g) states that a triple duplicate ack is detected after the 25th RTT, meaning that some
packet was lost when the cwnd was 8. I accepted either 4 or 7 (inflation) as the answer
for the cwnd value.

6
4 TCP/Congestion Control
Host A sends a file consisting of 9 MSS-sized segments to a host B using TCP. Assume
that the 4th segment in the transmission is lost. Assume the retransmission timeout
is T, the one-way latency is d, and that T > 4*d. Ignore the transmission time of the
segments and of the acknowledgements. Also, assume the TCP three-way handshake
has completed, but no data has been transmitted.

a) Assume no fast retransmission or fast recovery. Draw the time diagram showing
each segment and acknowledgement until the entire file is transferred. Indicate on the
diagram all changes in the cwnd and ssthresh. How long does it take to transfer the
file?
b) Answer part (a) assuming TCP Reno, i.e., the TCP version that implements both
fast retransmission and fast recovery.
c) Answer part (b) assuming that only the 6th segment is dropped.

Notes
• For Fast Recovery, assume that each duplicate acknowledgment increases cwnd
by 1.
• For Fast Recovery, assume that, upon receiving a non-duplicate acknowledg-
ment, cwnd drops back to ssthresh.
• If the value of cwnd is fractional, you should round it to the closest larger integer.
• The transfer time is the time interval measure at source A from the time the first
segment is sent until the acknowledgement of the last segment is received

7
Answer

A B A B A B
cwnd=1 cwnd=1 cwnd=1
1 1 1

2 2 2
cwnd=2 cwnd=2 cwnd=2
2,3 2,3 2,3

3,4 3,4 3,4


cwnd=4 cwnd=4 cwnd=4
X4,5,6,7 X4,5,6,7 X
4,5,6,7

4,4,4 4,4,4 5,6,6


cwnd=5, cwnd=6
TIMEOUT ssthresh=2 4,8 8,9
cwnd=1,
4 9 6,6
ssthresh=2
cwnd=2 cwnd=6,
8 9 ssthresh=3 6
cwnd=2
8,9 10 10
cwnd=3 cwnd=3
cwnd=3 9,10

Transfer Time=8*d + T Transfer Time=10*d Transfer Time=10*d


(a) (b) (c)

Notes: People lost the most number of points on this problem. People indicated on their
timing diagrams that segments 5,6 and 7 are resent; I automatically deducted 2.5 pts for
the first subproblem, and 2 pts for the second subproblem if you did this. You should
know by now (after doing the project and seeing this material in lecture/discussion)
that the receiver has a buffer to place out of order segments. Also, people forgot to read
the lecture notes about the ACKing conventions; I explicitly posted on moodle that you
should review those conventions before doing this problem. Also, note that when you
inflate your window in b), the sender has the ability to send out one additional segment,
namely, 8. I included an additional subproblem c) if you would like more practice on
this type of problem.

8
5 Link State

A B C
1 7

4 3 2 3 1

2 5

D E F
Given the following network topology, fill in the table showing the step- by-step
operation of the link-state algorithm for node B.

Step Confirmed Tentative

9
Answer

Step Confirmed Tentative


1 (B,0,-)
2 (B,0,-) (A,1,A), (C,7,C), (E,2,E)
3 (B,0,-), (A,1,A) (C,7,C), (E,2,E)
4 (B,0,-), (A,1,A) (C,7,C), (E,2,E), (D,5,A)
5 (B,0,-), (A,1,A), (E,2,E) (C,7,C), (D,5,C)
6 (B,0,-), (A,1,A), (E,2,E) (C,5,E), (D,4,E), (F,7,E)
7 (B,0,-), (A,1,A), (E,2,E), (D,4,E) (C,5,E), (F,7,E)
8 (B,0,-), (A,1,A), (E,2,E), (D,4,E), (C,5,E) (F,6,E)
9 (B,0,-), (A,1,A), (E,2,E), (D,4,E), (C,5,E) (F,6,E)

Notes: People lost minor points on this problem. People did not notice that to reach F,
you go through E, then C, then F; this gives you a cumulative cost of 6. I only looked
at the last entry in your table.

10
Homework 4

1 Distance Vector
Consider the network shown in the figure. Assume the network uses split horizon/poisoned
reverse.
A C
5 1

X
1 1

a) Fill in the following distance vector tables after the nodes converge.

DA B C X
B
C
X

DB A C DC A B
A A
C B
X X

b) Suppose the link between X and A fails. Show how the distance vector table entries
for X evolve for nodes A, B and C. Show the changes that occur during the first 6
iterations of routing update exchanges. The first update should consist of A updating
its cost to destination X via X to ∞. Explicitly note when updates are sent, when
updates are received, and when nodes poison each other. Assume that:

• Routing information exchanges and table updates are synchronous (meaning that
they occur at the same time)

1
• Updates produced from the prior iteration are sent before processing updates
received during the current iteration.
• Assume that if a node has two next hops of equal cost to the same destination, it
will chose the node that occurs first in the alphabet.

Answer
a)

DA B C X
B 1 2 ∞
C 2 1 ∞
X ∞ ∞ 5

DB A C DC A B
A 1 2 A 1 2
C 2 1 B 2 1
X 6 7 X 6 7

2
b)
Iteration 1: A updates its distance vector entry for X.

DA B C X
X ∞ ∞ ∞

Iteration 2: B and C both receive A’s update.

DB A C DC A B
X ∞ 7 X ∞ 7

Iteration 3: B and C send their updated distance vectors to A. Meanwhile, they send
poisoned updates to each other.

DA B C X DB A C
X 8 8 ∞ X ∞ ∞

DC A B
X ∞ ∞

Iteration 4: A chooses B as the next hop; A sends updates to B and C, but the update
sent to B is poisoned (no effect). A receives the updates from B and C, causing A to
update its entries for destination X to ∞.

DA B C X DC A B
X ∞ ∞ ∞ X 9 ∞

Iteration 5: C updates B with the new routing information to reach X; C sends a


poisoned update back to A (no effect). A updates B and C with a cost of ∞ to reach X.

DB A C DC A B
X ∞ 10 X ∞ ∞

Iteration 6: B sends an update to A and sends a poisoned update back to C (no effect).
C sends its updated distance vector to B. The rows for destination X after the 6th
iteration are shown.
DA B C X DB A C DC A B
X 11 ∞ ∞ X ∞ ∞ X ∞ ∞

3
2 BGP
Consider the network shown in the following figure. For parts a) and b), assume that if
a customer has an equally good choice of providers to send outbound traffic through,
the customer will pick the provider with the lowest AS number. Assume the nodes
evaluate path choices using the shortest hop count metric.

provider customer
peer peer

A B

AS 1 AS 2

C AS 3 AS 4 AS 5 D

AS 6 AS 7

E F

a) What path would E take to reach B?


b) What path would F take to reach C?
c) Network operators typically like to equalize the amount of traffic coming from
multiple providers. Suppose AS 6 owns prefix 123.4.0.0/16, and all IP addresses
in this prefix receive approximately the same amount of traffic. AS 6 has two
options for announcing this prefix. In the first option, AS 6 sends the same
announcement to both AS 3 and AS 4. In the second option, AS 6 announces
123.4.0.0/17 to AS 3 and 123.4.128.0/17 to AS 4. Discuss the pros and cons of
both approaches.
d) Suppose AS 3 and AS 4 become engaged in a bitter corporate rivalry. AS 3
wishes to implement a policy where any of its outbound traffic will avoid travers-
ing AS 4. Using only your knowledge of BGP, what would you advise AS 3 to
do?

Answer
a) E → AS 6 → AS 3 → AS 1 → AS 2 → B

4
b) F → AS 7 → AS 5 → AS 2 → AS 1 → AS 3 → C
Note: Many people missed this question; it was worth 2 points. If the packet
from F to C traversed AS 4, it would be traversing two peering hops; AS 4 gains
nothing by providing this transit service.
c) The first option does nothing to equalize the traffic coming from either provider.
A portion of the Internet will route to AS 6 via AS 3, and the rest will route
through AS 4. There is no guarantee that the amount of traffic is balanced
through either provider.
The second option equalizes the traffic, but has an adverse effect on BGP scala-
bility. Suppose every AS subdivides the prefixes they announce into two parts;
each BGP router would need to double the amount of space used in its forward-
ing table. Also, suppose that the link between AS 3 and AS 6 (or AS 4 and AS 6)
is of poor quality (lossy, low capacity, high latency, etc.). Half the hosts behind
AS 6 will be subject to bad service, even though an alternate path to reach them
exists.
d) AS 3 should choose routes that do not include AS 4 in their AS PATH attributes.
Note: I wanted you to specifically mention the AS PATH attribute. I was looking
for a solution where outbound traffic would not cross AS 4, meaning that you
should eliminate all routes that go through AS 4.

3 Fair Queuing
For parts a) and b), assume that the four flows are traversing a router that implements
fair queuing. They are competing for a link with a bandwidth of 16 Kbps.

a) Flow A transmits at a rate of 1 Kbps, flow B at 1 Kbps, flow C at 4 Kbps, and


flow D at 10 Kbps. How much bandwidth will each flow get under fair queuing?
b) Flow A transmits at a rate of 4.5 Kbps, flow B at 1 Kbps, flow C at 5.25 Kbps, and
flow D at 8 Kbps. How much bandwidth will each flow get under fair queuing?
c) Consider the network depicted in the following figure.

FlowA=10

BW1-2=4
R1
FlowB=5 BW2-D=8
R2
FlowC=4
HD

FlowA transmits at a rate of 10 Kbps at router R1 . FlowB transmits at a rate of


5 Kbps at R1 . Both are competing for the same outgoing link at R1 and that link
has 4 Kbps of available bandwidth (represented by BW1−2 in the figure). At R2 ,

5
FlowA is competing with FlowB and FlowC . How much bandwidth will each
flow be allocated at R2 ?

Answer
a)
i. Iteration 1: Each flow receives 1/4 of the 16 Kbps bandwidth. Flow A is satisfied
with 1 Kbps, flow B is satisfied with 1 Kbps, and flow C is satisfied with 4 Kbps.
ii. Iteration 2: Flow D is satisfied with 10 Kbps.
b)
i. Iteration 1: Each flow receives 1/4 of the 16 Kbps bandwidth. Flow B is satisfied
with 1 Kbps.
ii. Iteration 2: Each flow receives 1/3 of the remaining 15 Kbps bandwidth. Flow A
is satisfied with 4.5 Kbps.
iii. Iteration 3: Each flow receives 1/2 of the remaining 10.5 Kbps bandwidth. Flow
C is satisfied with 5.25 Kbps, and flow D gets 5.25 Kbps.
c) At R1 , Flow A will be allocated 2 Kbps, and Flow B will be allocated 2 Kbps. At
R2 , each flow will receive 1/3 of the 8 Kbps bandwidth, meaning Flow A will receive
2 Kbps, Flow B will receive 2 Kbps, and the remaining 4 Kbps will be allocated to
Flow C.

4 RED
Suppose a router implements RED for congestion avoidance, with maxP=0.02. The
router is currently processing two flows, A and B. Suppose the average queue length
is 12 packets, while the minimum and maximum thresholds are 8 and 16 packets, re-
spectively. For the purposes of this problem, assume the average queue length has
stabilized, meaning perturbations in the queue length do not affect its value.

a) Compute the drop probability for an incoming packet if the number of packets
queued since the average length crossed the minimum threshold is 10.
b) Suppose flow A and flow B are about to send 8 packets each, with flow A’s
packets arriving at the router before flow B’s do. Prior to the arrival of flow A’s
first packet, the number of packets queued since the average length crossed the
minimum threshold is 6. All 8 of flow A’s packets are enqueued at the router.
What is the probability that none of flow B’s packets are dropped?

Answer
a) TempP = maxP ∗ (AvgLen − MinThreshold)/(MaxThreshold − MinThreshold)
TempP = 0.02 ∗ (12 − 8)/(16 − 8) = 0.01
P = TempP/(1 − count ∗ TempP)
P = .01/(1 − 10 ∗ 0.01) = .01/.90 = 1/90

6
b) count will be 14 when the first packet from flow B arrives (6 from before flow
A sent its packets and 8 from flow A). Let PB,i denote the probability that flow
B’s ith packet is dropped if B’s prior i-1 packets are successfully enqueued.
The first packet from B will be dropped with probability:
PB,1 = .01/(1 − 14 ∗ 0.01) = .01/.86 = 1/86
If B’s first packet is successfully enqueued, then the second packet from B will
be dropped with probability:
PB,2 = .01/(1 − (14 + 1) ∗ 0.01) = .01/.85 = 1/85
Thus,
Q8 the probability that all 8 of flow B’s packets are successfully enqueued is:
i=1 (1 − PB,i ) = (1 − 1/86) ∗ (1 − 1/85) . . . (1 − 1/79) = 78/86

5 Token Bucket
Consider the arrival traffic characterized by a token bucket with the following param-
eters: r (average rate) = 5 Mbps, R (maximum rate) = 10 Mbps, and b (token depth) =
100 Kb.

a) Compute the duration of time for which a flow can send at rate R before exhaust-
ing its tokens.
b) Using your previous answer, compute the number of bits transmitted before the
flow depletes its tokens.
c) Suppose the router allocates 50 Kb of buffer space for the flow discussed in parts
a) and b) of this problem. The allocated buffer must be drained at some rate
to ensure that no packets are lost, given the value computed in part b) of this
problem. What is the minimum sustained rate ra that must be allocated by the
router to ensure that no packets from this flow are dropped during the time period
computed in part a)?

Answer
a) The flow starts with a bucket containing b tokens. Those tokens are drained at a
rate R and replenished at a rate r. Thus, we solve the equation b−R∗t+r∗t = 0
for t, where t represents time. This simplifies to t = b/(R − r). Using the
numbers above, this gives us 102, 400b/(10, 000, 000bps − 5, 000, 000bps) =
1, 024/50, 000sec or 10/500sec or 10/512sec, depending on what size conven-
tions you use.
b) The flow sends at a rate R, and we know the duration from a). If we use the
general equation from the previous part, we have R ∗ b/(R − r). Using the
numbers above, 10, 000Kbps ∗ (10/500sec) = 200Kb.
c) We can only buffer 50 Kb. However, we know that the flow can send up to
200 Kb before depleting its token bucket. Thus, we need to make sure that we
empty the queue at a rate that makes up for the discrepancy, over the period
of time before the flow depletes its tokens. Let M denote the value computed
in part b), Ba denote the buffer size, and T denote the value computed in part

7
a). ra = (M − Ba )/T = (200Kb − 50Kb)/(10/500sec) = 7, 500Kbps or
7, 680kbps.

8
3. (40 pts) IP forwarding. Consider the network diagram below. Each router (a square in the figure)
is labeled with the names of its interfaces (e.g., eth0) and the IP addresses assigned to each. Each
network (a circle) is labeled with its network name and prefix length.

192.168.128/17   A   B   192.168.16/21  

192.168.128.1   192.168.16.1  
eth0   eth0  
10.0.1.2   10.0.2.2   192.168.8.1  
eth3  R1  eth1   eth3  R2  eth1   C  
10.0.2.1  
eth2   eth2  
192.168.7.2   10.0.3.1   192.168.8/22  

10.0.3.2  
eth0  
192.168.7.1  
D   eth3  R3  eth1  
192.168.4.1  
E  
eth2  
192.168.7/24   192.168.6.1   192.168.4/23  

F  

192.168.6/24  

a) (10 pts) The machine I’m typing this on has an IP address 192.168.9.12. To which of the net-
works above am I connected? What is the subnet mask my machine should use?

b) (10 pts) What is the most concise CIDR block R2 can use to describe the networks reachable
through R3?

4
c) (20 pts) Suppose R1 and R3 contain the following forwarding tables, respectively:

Destination Next Hop Interface


127.0.0.1/32 127.0.0.1 lo0
default 10.0.1.1 eth3
10.0.1/24 eth3
10.0.2/24 eth1
192.168.0/17 10.0.2.2 eth1
192.168.7/24 eth2
192.168.128/17 eth0

Destination Next Hop Interface


127.0.0.1/32 127.0.0.1 lo0
default 10.0.3.1 eth0
10.0.3/24 eth0
192.168.4/23 eth1
192.168.6/24 eth2
192.168.7/24 eth3

What path would a packet from my machine follow to a host on network F? Explain how the
packet is forwarded by showing the rows in each forwarding table that would be invoked. If the
packet is forwarded by R2, please list the forwarding table entries in R2’s table that would be
used.

5
CSE 123: Computer Networks 
Homework 2 
Out: 10/22 Due: 10/29 
 
Instructions 
1. Turn in a physical copy at the beginning of the class on 10/29 
2. Ensure the HW cover page has the following information clearly written 
a. Name 
b. UCSD email 
c. PID 
 
1. Sliding Window Protocol 
Suppose you are designing a sliding window protocol for a 4­Mbps point­to­point link that 
is 9 x 104 km long. Assuming each frame carries 4 KB of data, what is the minimum 
number of bits you need for the frame sequence numbers if 
L = 9 x 107 m 
S = 4 KB 
B = 4 Mbps 
 
The SWS should have enough frames to hold the packets that are 
needed to completely fill the pipe. This capacity, can be found 
using the bandwidth­delay product. 
In this approach, we estimate the bandwidth­delay product by the 
number of frames it takes to fill a pipe completely. 
Tdelay = L/c = 0.3 s 
RTT = 0.6 s 
Bfps = B/S = 123 fps (approx) 
Nf = Bfps x RTT = 74 frames (approx) 
 
Thus, SWS should hold at least 74 frames. 
  
a. RWS = 1 
If RWS = 1 then the receiver can handle only one frame at 
a time and hence to fully utilize the capacity of the link 
we’ll need to have at least 74 unique frame sequence 
numbers. 
Thus, we’ll need 7 bits. 
 
b. SWS = RWS 
In this case, the sender can send twice as many frames 
since the receiver can now store frames as well. Thus we 
can send as many as 148 frames to fully utilize the link. 
Thus, in this case we’ll need 8 bits. 
 
c. If we use the Stop­and­Wait ARQ protocol, what would be the maximum 
efficiency (defined as frames in transit/maximum possible frames in transit) that 
we can achieve? 
 
In Stop­and­Wait ARQ protocol we can have at most 1 frame 
in transit. However, we calculated that at the maximum we 
can have 74 frames in trasit. 
Efficiency = 1/74 = 0.014 or 1.4% 
 
Assume that communication happens at the speed of light, that is 3 x 108 m/s 
 
2. IP Checksum and Endianness 
The following IPv4 header, show in hex below, is received for an IP packet at its 
destination. Refer to the IPv4 header diagram below. 
 
4500 003c 1c46 4000 4017 c311 aca8 0101 aca8 0102 
 

 
a. What is the header checksum? (You can find it by mapping the hex values to the 
IPv4 header diagram) 
Header Checksum = c311 
b. Using the Internet checksum algorithm, determine if there were any errors in the 
transmission. (Show your work) 
4500 
+ 003c 
+ 1c46 
+ 4000 
+ 4017 
+ c311 
+ aca8 
+ 0101 
+ aca8 
+ 0102 
____________ 
0002 FFFD 
FFFD + 0002 = FFFF 
~FFFF = 0000 (Taking 1’s complement) 
As the final sum is 0, we know that there were no errors 
in the transmission. 
 
c. What would this packet which is network­byte order look like when stored in the 
memory of a big­endian system? 
The big­endian system is similar to the network­byte 
order. 
 
#  Data 

0  45 00 00 3C 

4  1C 46 40 00 

8  40 17 C3 11 

12  AC A8 01 01 

16  AC A8 01 02 
 
d. How about in the memory of a little­endian system? 
The little­endian system stores the least significant byte 
in the smallest address. 
 
#  Data 

0  3C 00 00 45 

4  00 40 46 1C 

8  11 C3 17 40 

12  01 01 A8 AC 

16  02 01 A8 AC 
 
The question aimed at pointing out some of the problems 
that could surface when you store data in a different 
endian system. 
3. CRC 
Suppose we want to transmit a message 1101 1001 0101 1001 and protect it from errors 
using the CRC generator x8 + x6 + x3 + 1 
a. What is the CRC generator sequence? (The CRC generator polynomial 
represented in a bit sequence) 
CRC Generator Sequence: 101001001 
b. How many bits will the resulting frame check sequence be? 
8 bits. 
c. What is the transmitted bit sequence (show your work)? 
Transmitted Sequence: 1101 1001 0101 1001 1101 0000 
d. How large a burst of errors can be detected? 
A burst error of maximum 8 bits can be detected. 
 
4. Spanning Tree Question 
Given the extended LAN shown below, indicate which ports are not selected by the 
spanning tree algorithm. 
 

 
 
 
5. Sliding Window Timeline 
Consider a network where the sliding window protocol is in use with SWS = RWS = 2 
frames and a one­​
way delay of 100 ms (i.e. for a frame sent at time t, it arrives at t + 100 
ms). Assume that when multiple frames are all able to be sent according to the window 
size, that they are sent 20 ms apart (i.e., frame 1 starts at time t, and frame 2 starts at 
time t + 20 ms). 
a. What would be a reasonable timeout value for this link?  Why not something 
smaller? How about  larger? 
A reasonable timeout would be anything slightly larger 
than the RTT. You ideally, want to have time for the 
packet to travel to the receiver and back while allowing 
some time for processing. 
If the timeout value were smaller then we would be 
unnecessarily retransmit packets. If the value were much 
larger than we would be wasting time by unnecessarily over 
waiting.  
b. Now, assume that by sending a frame every 5 ms we can saturate the link. In this 
case, determine the smallest SWS and RWS that maximizes throughput (i.e., 
keeps the link fully utilized). 
The bandwidth­delay product indicates the capacity of the 
link. If the sender can send a frame every 5 ms, then the 
sender can send 40 frames in 1 RTT. 
Thus, if we have SWS = RWS = 40 we’ll be able to keep the 
link fully utilized. 
 
6. 2D Parity 
a. Explain briefly why 2D parity can detect all 1 bit errors. Can the 1bit errors be 
corrected? 
A 2D parity is a combination of a row and column 1D 
parity. Hence, all 1­bit errors will be caught both in the 
row and column parity. This will help us identify the 
location of the 1­bit error and correct it. 
b. Again, explain briefly why 2D parity can detect all 2 bit and 3 bit errors? 
For 2­bit and 3­bit errors, either the row or the column 
parity will catch it. In the case, of 2­bit if the errors 
are in the same row then the column parity will catch it. 
Same goes, with 3­bit errors, that is, one of the 
bit­errors will lead to an incorrect parity and hence be 
detected. 
c. Why can it not detect all 4 bit errors?  Give an example of a 4 bit error that it can 
detect, and an example of a 4­bit error that it cannot detect. 
2D parity can detect most of the 4­bit errors. However, if 
the 4 bit errors are grouped such that any of the bit 
errors has a bit error both in the same row and same 
column as it is, then in that case both the row and column 
parity will check out and hence not detect the errors. 
 
CSE 123: Computer Networks 
Homework 3 Solutions 
 
1. Learning Bridges  

 
Consider the hosts W, X, Y, Z and the learning bridges B1, B2, B3. Assume, that they 
have empty forwarding tables to begin with and keep on adding entries based on the 
events. 
a. Suppose host X sends a packet to W. Which bridges learn the location of host X 
(i.e., which of the bridge’s interfaces should traffic destined to X be directed)? 
Also, does host Y see this packet? Also, which bridges learn the location of host 
W? 
Bridges B1, B2, B3 learn of the location of host X. Yes, 
the host Y will see this packet since each of the bridges 
will flood this packet since they do not know the location 
of W. No, the bridges do not learn the location of W since 
the bridges flood the packet but do not know flooding on 
which interface made W get the packet. 
 
b. Now, suppose host Z sends to X. Which bridges learn the location of host Z? 
Also, does host Y see this packet? Also, which bridges learn the location of host 
X from this transmission? 
Bridges B1, B2, B3 will learn the location of Z. No, host 
Y will not see this packet since the bridges already know 
the location of host X and hence do not need to flood the 
packet. As before, this transmission does not tell us 
anything about the host that receives the packet. 
 
c. Now, suppose host Y sends to X. Which bridges learn the location of host Y? 
Also, does host Z see this packet? Also, which bridges learn the location of host 
X from this transmission? 
Bridge B1, B2 will learn the location of Y. No, host Z 
will not see this packet. As before, this transmission 
does not tell us anything about the host that receives the 
packet. 
 
d. Now, finally host W sends to Y. Which bridges learn the location of host W? Does 
host Z see this packet? Also, which bridges learn the location of host Y from this 
transmission? 
Bridges B2, B3 will learn of the location of W. Yes, host 
Z will see this packet.As before, this transmission does 
not tell us anything about the host that receives the 
packet. 
 
2. IP Forwarding 
Consider the forwarding and (partial) ARP tables below take from a router 
connected to four different networks. The router uses the IP addresses 192.168.32.2, 
192.168.0.3, 192.168.6.1, and 192.168.7.1, on each of those networks, respectively. 
 
 
Destination  Next Hop  Interface 

127.0.0.1/32  127.0.0.1  lo0 

default  192.168.32.1  eth0 

192.168.0.0/16    eth0 

192.168.0.0/21    eth1 

192.168.4.0/22  192.168.0.4  eth1 

192.168.6.0/24    eth2 

192.168.7.0/24    eth3 
 
 
IP Address  MAC Address 

192.168.32.1  00:21:56:4a:38:00 

192.168.32.2  ba:e8:56:24:88:00 
192.168.0.4  78:31:c1:c5:7c:48 

192.168.0.3  00:50:56:c0:00:01 

192.168.6.1  00:50:56:c0:01:F1 

192.168.6.255  FF:FF:FF:FF:FF:FF 

192.168.7.1  0:50:56:c0:73:d8 
 
a. Suppose the following Ethernet frame arrived at a router with the tables above. 
(Only a subset of the header fields are shown.) Which entry in the forwarding 
table would it match? 
 
Eth Src  Eth Dst  IP Src  IP Dst  Payload 

00:21:56:4a:38:00  ba:e8:56:24:88:00  10.1.17.23  192.168.5.137  ... 


 
The following entry will be used in the forwarding table. 
 
192.168.4.0/22  192.168.0.4  eth1 
 
b. Assume that the packet is forwarded according to the tables above. What would 
the following fields of the frame contain as it leaves the router? 
 
Eth Src  Eth Dst  IP Src  IP Dst  Payload 

00:50:56:c0:00:01  78:31:c1:c5:7c:48  10.1.17.23  192.168.5.137  ... 


 
 
3. Link State Routing (OSPF) 
 
Build the routing table for node A in the network shown above using the Link State 
Routing Algorithm. (Show all the steps as shown in Table 3.14 in the textbook) 
 
 
No  Confirmed  Tentative 

1  (A,0,­)   

2  (A,0,­)  (C,6,C),(D,16,D) 

3  (A,0,­), (C,6,C)  (E,8,C),(D,16,D) 

4  (A,0,­), (C,6,C), (E,8,C)  (B,12,C),(D,12,C),(F,16,C) 

5  (A,0,­), (C,6,C), (E,8,C),(B,12,C)  (D,12,C),(F,16,C) 

6  (A,0,­), (C,6,C),  (F,16,C) 
(E,8,C),(B,12,C),(D,12,C) 

7  (A,0,­), (C,6,C),   
(E,8,C),(B,12,C),(D,12,C), (F,16,C) 
 
 
 
 
 
 
 
 
 
4. Distance Vector Routing 
For the network given above, give the global distance­vector tables when using Distance 
Vector Routing Algorithm for the following three instances 
a. Each node knows only the distances to its immediate neighbors. 
 
Info @  A  B  C  D  E  F 

A  0  ∞  6  16  ∞  ∞ 

B  ∞  0  ∞  ∞  4  ∞ 

C  6  ∞  0  ∞  2  ∞ 

D  16  ∞  ∞  0  4  ∞ 

E  ∞  4  2  4  0  8 

F  ∞  ∞  ∞  ∞  8  0 
 
b. Each node has reported the information it had in the preceding step to its 
immediate neighbors. 
 
Info @  A  B  C  D  E  F 

A  0  ∞  6  16  8  ∞ 

B  ∞  0  6  8  4  12 

C  6  6  0  6  2  10 

D  16  8  6  0  4  12 

E  8  4  2  4  0  8 

F  ∞  12  10  12  8  0 


 
c. Step (b) happens a second time. 
(Refer to Table 3.10 in the textbook for how the global distance­vector tables should look 
like!) 
 
Info @  A  B  C  D  E  F 

A  0  12  6  12  8  16 

B  12  0  6  8  4  12 
C  6  6  0  6  2  10 

D  12  8  6  0  4  12 

E  8  4  2  4  0  8 

F  16  12  10  12  8  0 


 
 
5. Distance Vector Routing vs Link State Routing 
What characteristic of the updates in distance­vector routing help it scale better than 
link­state routing? 
In the distance vector routing the updates are only sent to the 
immediate neighbors while in the link state routing the updates 
are sent out to all the nodes. Thus, if the network has a lot 
of nodes the updates might take a really long time in 
link­state routing. Hence, distance­vector routing scales 
better than link­state routing. 
 
6. Routing Protocols 
a. Give an example of an intradomain and an interdomain routing protocol. 
Intradomain ­ OSPF, RIP 
Interdomain ­ BGP 
 
b. The Internet uses different protocols for inter and intra domain routing. Give one 
reason why we do not use an intra­domain routing protocol for inter­domain 
routing. 
Intradomain protocols try to be as responsive as possible 
by leveraging knowledge of the entire network. However, 
some ASes do not wish to reveal/expose the internal 
topology of their network to other ASes. Hence, 
intradomain routing protocols aren’t used in interdomain 
routing. 
 
c. In BGP, what is the difference between a customer/provider and peer AS 
relationship? In each of the relationships, who typically pays whom?  
In a customer/provider relationship the customer pays the 
provider for access to everyone via the provider while not 
acting as a transit for the provider. On the other hand 
peer relationships are more of an equal relationship in 
which ASes provide transit for each others’ customers to 
their own customers, and vice versa. 
 
7. Split Horizon and Poison Reverse 
 

 
All of the links in the above network have weight 1. All entries in the routing table are 
timed, ie. if node fails to receive an update for the particular entry for more than a certain 
time interval, then the entry is marked invalid and discarded. 
 
a. Now suppose that after the link between B and C fails, the following events occur 
in order given below:  
Event 1: B sends a route update saying the cost to reach C is infinite. (Note: 
Though the route update is sent the other nodes do not receive the update right 
away and will receive the route update only in later events!) 
Event 2: Simultaneously both A and D send updates saying that each can reach 
C with a cost of 2.  
Event 3: Now, A gets an update from B and D at the same time. The update 
from B is what was sent at Event 1 while the update from D was sent at Event 2. 
After getting these two updates, A updates its routing table to say that it can 
reach C via D with a cost of 3. 
Event 4: Similarly, D will make a similar update after getting the update from B 
and A. That is, D updates its routing table to say that it can reach C via A with a 
cost of 3. 
 
Given the state of the network above, briefly explain how this scenario would 
continue if the network were to, from this point on, implement  
i. Split horizon 
ii. Split Horizon with Poison Reverse. 
 
 
i.In Split​
 Horizon, both A and D will not advertise to each 
other since they learn about the path from each other. 
After B chooses one of them to be its parent it will 
advertise a route to C with cost 4. However, both A and D 
have routes with cost 3 via each other. Hence, neither A 
and D will use the update that B sent. Eventually, all the 
entries will time out! 
 
ii. If Split Horizon with Poison Reverse is added, then the 
count to infinity will end immediately, since A and D will 
send each others saying that the distance to C for them is 
∞ , since they learnt it from each other. 
 
Note: Your points depend on how well you have explained 
what happens. Points have been allocated based on 
explanation if you’ve listed another possible scenario. 
 
b. Now again suppose that if in the network above, the link between B and C goes 
down, list a sequence of events in which Split Horizon with Poison Reverse will 
fail to prevent a loop? (Assuming we use Split Horizon with Poison Reverse from 
the start) Use the following notation to describe the events ie. the messages sent 
by the nodes.  
Notation: [(X­>Y, #) to Z] denotes that X can reach Y in a distance # and 
the update is sent to Z.  
 
1.[(B­>C, ∞ ) to D] 
2.[(A­>C, 2) to D]  
3.[(B­>C, ∞ ) to A] 
4.[(D­>C, 3) to B] 
5.[(A­>C, ∞ ) to D] 
6.[(B­>C, 4) to A] 
7.[(D­>C, ∞ ) to B] 
8.[(A­>C, 5) to D] 
9.[(B­>C, ∞ ) to A] 
10. [(D­>C, 6) to B] 
 
And the oscillations will continue and count to infinity. 
CSE 123: Computer Networks 
Homework 4 Solutions 
Out: 12/03 Due: 12/10 
 
1. Routers and QoS 
 
Packet #  Size  Flow 

1  100  1 

2  110  1 

3  50  1 

4  160  2 

5  80  2 

6  240  2 

7  90  3 

8  180  3 
 
Suppose a router has three input flows and one output. It receives the packets listed in 
the table above all at about the same time, in the order listed, during a period in which 
the output port is busy but all queues are otherwise empty. 
 
Give the order in which the packets are transmitted for 
a. Fair queuing. 
First we calculate the finishing times Fi. In this case, we  
have Ai = 0 hence, Fi just becomes Fi­1 and Pi 
 
Packet #  Size  Flow  Fi 

1  100  1  100 

2  110  1  210 

3  50  1  260 

4  160  2  160 

5  80  2  240 
6  240  2  480 

7  90  3  90 

8  180  3  270 
 
Thus, Packets in the order: 7, 1, 4, 2, 5, 3, 8, 6 
 
b. Weighted fair queuing with flow 2 having twice as much share as flow 1, and 
flow 3 having 1.5 times as much share as flow 1. 
Note: Resolve ties in the order of flow 1, flow 2, and flow 3. 
In this case, we are weighting the flows. To simplify our 
calculations we give F1 a weight of 2 F3 a weight of 4 F3 a 
weight of 3 so that we have the shares mentioned above. 
Accordingly the Fi changes as below. 
 
Packet #  Size  Flow  Weighted Fi 

1  100  1  50 

2  110  1  105 

3  50  1  130 

4  160  2  40 

5  80  2  60 

6  240  2  120 

7  90  3  30 

8  180  3  90 
 
Thus, Packets in the order: 7, 4, 1, 5, 8, 2, 6, 3 
 
 
2. Congestion Avoidance: RED 
Consider a RED gateway with MaxP = 0.02, and with an average queue length 
halfway between the two thresholds. 
a. Find the drop probability Pcount for count = 10 and count = 50. 
AvgLen − MinThreshold
   T empP   =  MaxP   * MaxThreshold − MinThreshold  
AvgLen is halfway between MinThreshold and MaxThreshold, 
which implies that the fraction here is ½ and so TempP = 
MaxP/2 = 0.01. We now have Pcount = TempP/(1 − count × 
TempP) = 1/(100−count).  
For count=10 this is 1/90; for count=50 it is 1/50. 
 
b. Calculate the probability that none of the first 10 packets are dropped. 
This is the probability that the first packet is not 
dropped times the probability that the second packet is 
not dropped times the probability…  
98 97 96 ...    89 =   89 =  89.899%  
99 * 98 * 97 * * 90 99   
 
3. Congestion Control and Congestion Avoidance 
a. What is the main benefit that RED provides when compared to drop­tail? 
The main benefit of RED is that it tries to be ‘proactive’ 
and avoid congestion while drop­tail is a congestion 
control mechanism and more ‘reactive’. 
 
b. What is the difference between congestion avoidance and congestion control? 
In congestion avoidance we try to remain to the left of 
the ‘knee’ that is try and be proactive. On the other 
hand, in congestion control we try to the left of the 
cliff, that is try and be reactive.  
 
c. Assume we have a simple network with 5 hosts and a router. The router 
connects each of the 5 hosts in a star topology. The RTT between each pair of 
hosts is 10 ms.  Each host uses a simple UDP query and response protocol 
(i.e., each packet sent to a destination results in a single packet being sent 
back to the sender) to communicate between hosts.  Additionally, if a sender 
does not receive a response within 20 ms, it retransmits the request.   Multiple 
requests can be outstanding at one time, but each request will be retransmitted 
until a response is received. 
 
Assume that the router queue is empty at the beginning. All hosts start sending 
requests to each other at a very high (fixed) rate. Very shortly thereafter, we 
notice a congestion collapse. Briefly explain (however, please be precise about 
your assumptions) how each of the following techniques, if implemented, would 
affect/prevent the congestion collapse? 
 
i. Double the timeout value from 20 ms to 40 ms. 
This might help avoid the collapse. If the buffers in 
the router are deep, then there is a possibility that 
the packet is still in the router queue when we 
decide to retransmit the packet. Hence, there is a 
chance that increasing the timeout may prevent 
congestion collapse as this can possible give the 
packet a chance to make it out of the router queue. 
 
ii. Double the size of the queue in the router.  
This might also help avoid collapse. If the router 
buffers are currently shallow then increasing the 
size of the queue can possibly help as it can reduce 
the number of retransmissions. 
 
iii. If a query is not answered within a timeout interval, multiplicatively 
reduce the maximum rate at which the client sends query packets. 
This will most definitely help. This is in essence, 
the multiplicative decrease that TCP uses. 
  
iv. Use a flow control window at each receiver to prevent buffer overruns. 
Not really, since flow control will not help as it 
doesn’t directly help reduce the traffic sent to the 
router. Note, flow control is not the same as 
congestion control. 
 
4. Network Address Translation 
Network Address Translation, NAT, is the translation of an Internet Protocol address 
(IP address) used within one network to a different IP address known within another 
network.  
a. Why do we need NAT? Why is it a service that is present on many routers 
today? 
The number of IPv4 addresses is much less than the number 
of devices. As a result, using NAT has become necessary. 
Another cause for NAT to become popular is that it allows, 
private networks where the organization cannot afford 
enough IP addresses for each of its hosts. 
 
b. NAT is considered to be a temporary solution. What technology when deployed 
will do away with the need of NAT? 
It is hoped that IPv6 when deployed will do away with the 
need of NAT. 
 
Recall, a NAT capable router essentially translates private address within a network to 
public addresses that can be used publicly. In this question, we try and understand the 
working behind a simple NAT capable router. A simple NAT capable router will have 
mappings between the private addresses within the network (here, the private 
addresses all fall within the 10/8 network) to the public address(es) that it uses. Let us 
assume that the router has a single public address 138.76.29.7 which it uses for all 
communication with hosts that are not part of the private network.  The router 
multiplexes its public IP address(es) as needed and keeps track of the multiplexing in 
a NAT translation table.  
 
Assume that the router multiplexes the public address using ports starting from 8000 
and then incrementing by one. For example, if a host in the private network with 
address 10.0.0.5:5000 sends a message to 132.239.8.45:80 then the entry in 
the NAT table would be filled in as below. The next time the router will use 8001 as 
the port to establish a new connection and so on.  
 
NAT Translation Table 

WAN Side Address  LAN Side Address 

138.76.29.7:8000  10.0.0.5:5000 

138.76.29.7:8001  10.0.0.6:5000 

138.76.29.7:8002  10.0.0.10:6000 

138.76.29.7:8003  10.0.1.101:6001 

138.76.29.7:8004  10.0.0.7:7000 
 
Note: iv, v, vii, viii will not create any new entries. 
 
c. What would be the entries in the NAT Translation Table at the end of the 
following events 
i. 10.0.0.6:5000 sends a message to 74.125.239.33:80 
ii. 10.0.0.10:6000 sends a message to 204.79.197.200:80 
iii. 10.0.1.101:6001 sends a message to 206.190.36.45:80 
iv. 10.0.0.10:6000 sends another message to 204.79.197.200:80 
v. 10.0.1.101:6001 sends a message to 74.125.239.33:80 
vi. 10.0.0.7:7000 sends a message to 63.245.215.20:80 
vii. 204.79.197.200:80 sends a message to 10.0.0.10:6000 
viii. 206.190.36.45:80 sends a message to 74.125.239.33:80 
 
Note: The NAT Table should like the one above with the entries generated from 
the events in (c.) filled in 
 
d. For simplicity, let us assume that message format is MSG<Sender, 
Receiver>. In that case,  if a host in the private network with address 
10.0.0.5:5000 sends a message to 132.239.8.45:80 then the message 
recevied at the router and leaving at the router would look as follows 
Message Received from Host: MSG<10.0.0.5:5000, 132.239.8.45:80> 
Message Sent from Router: MSG<138.76.29.7:8000,132.239.8.45:80> 
Note: We will need to use the entries from the table we filled in (c.) to do this. 
 
List out the message received from the host at the router and the message sent 
from the router (like shown above) for the following messages: 
1. 10.0.0.6:5000 sends a message to 74.125.239.33:80 
Incoming: MSG<10.0.0.6:5000, 74.125.239.33:80> 
Outgoing: MSG<138.76.29.7:8001,74.125.239.33:80> 
 
2. 10.0.0.10:6000 sends a message to 204.79.197.200:80 
Incoming: MSG<10.0.0.10:6000, 204.79.197.200:80> 
Outgoing: MSG<138.76.29.7:8002,204.79.197.200:80> 
 
e. If the router gets a message 
MSG<74.125.239.33:80,138.76.29.7:8001>, what would the message 
look like leaving the router? 
Outgoing: MSG<74.125.239.33:80,10.0.0.6:5000> 
 
f. Finally, if the router gets a message MSG<10.0.0.10:6000, 
10.0.1.101:6001>, what what would the message look like leaving the 
router? 
No change since the message is within the private network. 
MSG<10.0.0.10:6000, 10.0.1.101:6001> 
4. (15 pts) Bridging. Consider the extended LAN shown below.

A
B
B3

C B5

D B7 K

E F

B1 B2

G H

B4
B6
I
J

a) (5pts). Indicate which ports are not selected by the spanning tree algorithm.

B7’s port to network B and B6’s port to network I will be disabled.

b) (10pts). After convergence, what is the configuration message B6 sends? Which network(s)
does it send it to?

(B1, 2, B6). It sends it only to the network where it is “best”, namely network J.

5
a) Frame with sequence number 3 is lost.
0, 1, 2, 3, 4, 5, 6, 3, 7, 8
b) Frame with sequence numbers 3, 4, 5 and 7 are lost.
0, 1, 2, 3, 4, 5, 6, 3, 4, 5, 6, 7, 8, 7, 8

Assume that ONLY the frames mentioned in each part are lost and ONLY during their first
transmission. No other frame, ACK or retransmission is lost.

5) Spanning tree
Given the extended LAN shown below, indicate which ports are not selected by the spanning tree
algorithm.

6) Learning bridge
Consider the below network with bridges B1, B2, B3 and B4 with learning capability. All the nodes in
the system have just booted up and all their forwarding tables are initially empty. Write down the
forwarding tables of each bridge for the following sequence of events. Assume the events are in
sequence and the tables from the previous step are retained.
a) B sends to C
Bridge B1 Bridge B2
Destination Port Destination Port
B 3 B 1

Bridge B3 Bridge B4
Destination Port Destination Port
B 2 B 1

b) A sends to B
Bridge B1 Bridge B2
Destination Port Destination Port
B 3 B 1
A 1
Bridge B3 Bridge B4
Destination Port Destination Port
B 2 B 1
A 1

c) E sends to A
Bridge B1 Bridge B2
Destination Port Destination Port
B 3 B 1
A 1 E 2
E 2

Bridge B3 Bridge B4
Destination Port Destination Port
B 2 B 1
A 1 E 1

7) IPv4 header
Below is a diagram of the IPv4 header with its fields specified. As shown below, the width of each row
is 32 bits (0-31).
An IPv4 packet is received at the destination. The IPv4 header of that packet has been mentioned below
in network byte order. (The representation is in hexadecimal):
4500 0054 0000 4000 4001 7066 5014 010a 7620 0305

a) What is the IP header checksum value sent in this packet?


0x7066
b) Compute the header checksum for the packet using Internet checksum algorithm (show your
work). Is there an error present in the header of the packet?
4500 + 0054 + 0000 + 4000 + 4001 + 7066 + 5014 + 010a + 7620 +
0305 = 1fffe
Adding overflow back to least significant 16-bits = fffe + 1 = ffff
Checksum = ~ffff = 0000

No error.
c) Assuming the total length and header length fields to be error free, compute the length of the
payload in this case? Show your work.
Total length = 0x0054 = 84 bytes
Header length = 0x5 32-bit words = 5 * 32 bits = 20 bytes
Payload length = total length – header length
= 84 – 20 = 64 bytes
d) Find the TTL. Compute the new checksum after decrementing the TTL by 1.
TTL = 0x40 = 64
new TTL = 63 = 0x3f

4500 + 0054 + 0000 + 4000 + 3f01 + 0000 + 5014 + 010a + 7620 +


0305 = 18e98

Add the overflow back to the least significant 16 bits


= 8e98 + 1 = 8e99
New checksum = ~ 8e99 = 7166
CSE 123: Computer Networks
Homework 3
Out: 11/11, Due: 11/18
Instructions:
1. Turn in a physical copy at the beginning of the class on 11/18.
2. Ensure the HW cover page has the following information clearly written:
a. Name
b. UCSD email
c. PID
3. Please contact the TAs or post on Piazza to seek any clarification.
4. The homework is to be done individually.

1. Link State Routing


Build the routing table for node A in the network shown in the figure 1 using the Link State Routing.
Show all the steps as shown in Table 3.14 in P&D 5th edition. The respective distances are mentioned
on the edges.

Figure 1: Network for questions 1 & 2


No. Confirmed Tentative
1 (A, 0, -)
2 (A, 0, -) (E, 1, E), (B, 8, B)
3 (A, 0, -), (E, 1, E) (B, 8, B), (D, 2, E), (F, 5, E)
4 (A, 0, -), (E, 1, E), (D, 2, E) (B, 8, B), (F, 4, E), (C, 8, E)
5 (A, 0, -), (E, 1, E), (D, 2, E), (B, 8, B), (C, 6, E)
(F, 4, E)
6 (A, 0, -), (E, 1, E), (D, 2, E), (B, 7, E)
(F, 4, E), (C, 6 E)
7 (A, 0, -), (E, 1, E), (D, 2, E),
(F, 4, E), (C, 6 E), (B, 7, E)

2. Distance Vector Routing


For the network given in figure 1, give the global view tables using Distance Vector Routing for the
following instances:
a) Each node knows only the distances to its immediate neighbors.

A B C D E F
A 0 8 ∞ ∞ 1 ∞
B 8 0 1 ∞ ∞ ∞
C ∞ 1 0 6 ∞ 2
D ∞ ∞ 6 0 1 2
E 1 ∞ ∞ 1 0 4
F ∞ ∞ 2 2 4 0

b) Each node has reported the information it had in the preceding step to its immediate neighbors.

A B C D E F
A 0 8 9 2 1 5
B 8 0 1 7 9 3
C 9 1 0 4 6 2
D 2 7 4 0 1 2
E 1 9 6 1 0 3
F 5 3 2 2 3 0
c) Final convergence occurs.

A B C D E F
A 0 7 6 2 1 4
B 7 0 1 5 6 3
C 6 1 0 4 5 2
D 2 5 4 0 1 2
E 1 6 5 1 0 3
F 4 3 2 2 3 0
th
Note: Refer to Table 3.10 in P&D 5 edition for how the global view tables should look like.

3. Link State Routing issues


Suppose that the nodes in the network shown in figure 2 participate in link-state routing, and C receives
contradictory LSPs: One from A arrives claiming the link A-B is down, but one from B arrives claiming
the A-B link is up. The links A-C and B-C are considerably longer than the link A-B.

Figure 2: Network for question 3


a) How could this happen? Explain the scenario which can lead to the described situation.
It can occur when the event between A and B is realized by the two at
different times. Say, the link goes down. The timer for the route needs to expire
in A and B for them to realize that (or by using some Link state protocol) or for C
to send them this info after getting it from one of the two nodes. The later is not
a possibility since C is two far. Now A and B can experience timeouts at different
times (or their Link-state protocols detect at different times) leading to them
sending different messages.
b) What should C do? What can C expect to happen eventually?
C has no way but to trust the higher sequence LSP packet from respective
nodes. If the sequence number is lower than the one used to install the route, it
will be discarded and if higher, the route will be updated.
Eventually C will expect to get higher sequence number packets containing the
same information from both A and B leading to convergence.
Do not assume that the LSPs contain synchronized timestamp.

4. Split horizon and Poison reverse

Figure 3: Network for question 4

Suppose routers A and B in figure 3 somehow end up with following forwarding-table entries:
1. At A: <D,B,n> and
2. At B: <D,A,m>
(where <x, y, z> refers to path to node x via node y of length z),
This creates a routing loop. Write down the messages exchanged for the following cases to remove the
loop:
i. if A and B both use poison reverse with split horizon
In this case, A and B send <D, A, ∞ > and <D, B, ∞ > respectively to
each other leading to immediate removal of the loopy route from both of them. Now
the two nodes can likely receive <D, C, x> from C thereby, updating their routes
since x < ∞ and stopping the poisoning. It may be possible that A eventually
updates to some <D, B, y> if y < x ie., A has a shorter route via B rather than via
C. If this happens, A will continue to poison B about route to D via A.
ii. if A and B use split horizon only.
In this case, A and B will stop sending each other messages about D.
Eventually either timeout for the routes occurs or a better message from C arrives
<D, C, x>. If x < m (or n), the B (or A) updates the route to <D, C, x>. If timeout
occurs, then eventually an update from C will update both the nodes. Like above,
there is a possibility that A has a shorter route via B rather than C. If this
happens, A will update to <D, B, y> and continue to not send this update to B.
Which one converges faster?
Poison with split horizon converges faster since, the negative weights
immediately remove the loopy routes and the next update from C will lead to
convergence. On the other hand, split horizon needs to wait for the timeout.

5. Routing
Consider the network shown in figure 4 where R1 and R2 are routers while C (client) and S (server) are
hosts. The forwarding table and ARP cache for the both the routers is given below:
Figure 4: Network for question 5

Router R1
Routing table (R1) ARP cache (R1)
Destination Next hop Interface IP address MAC address
127.0.0.1/32 lo0 10.10.10.2 80:19:34:12:1c:31
default 192.168.0.200 eth2 192.168.0.197 4a:3c:4f:44:33:21
20.20.0.0/16 192.168.0.200 eth2 10.10.10.3 c4:54:44:e1:6a:4e
10.10.10.0/24 eth1
192.168.0.0/16 eth2

Router R2
Routing table (R2) ARP cache (R2)
Destination Next hop Interface IP address MAC address
127.0.0.1/32 lo0 192.168.0.200 3e:4c:43:2f:22:1a
default 192.168.0.197 eth1 192.168.0.197 4a:3c:4f:44:33:21
20.20.0.0/16 eth2 20.20.20.2 8a:9c:45:2a:35:56
10.10.10.0/24 192.168.0.197 eth1 20.20.20.3 79:3a:23:1f:6c:da
192.168.0.0/16 eth1

Client C (10.10.10.2) sends an IP packet destined to the server S (20.20.20.2). Write down the packets
(IP and ARP) sent and received by the router R2 at both of its interfaces. The packets must be
mentioned in the sequence they are received/sent. Label each packet with:
i. the source and destination Ethernet addresses,
ii. source and destination (or target) IP addresses and
iii. the interface at which they are sent/received at R2.

1. ARP request (at eth1)


Src MAC: 4a:3c:4f:44:33:21
Dst MAC: ff:ff:ff:ff:ff:ff
Src IP: 192.168.0.197
Target IP: 192.168.0.200

2. ARP response (at eth1)


Src MAC: 3e:4c:43:2f:22:1a
Dst MAC: 4a:3c:4f:44:33:21
Src IP: 192.168.0.200
Target IP: 192.168.0.197

3. IP packet (at eth1)


Src MAC: 4a:3c:4f:44:33:21
Dst MAC: 3e:4c:43:2f:22:1a
Src IP: 10.10.10.2
Dst IP: 20.20.20.2

4. IP packet (at eth2)


Src MAC: 79:3a:23:1f:6c:da
Dst MAC: 8a:9c:45:2a:35:56
Src IP: 10.10.10.2
Dst IP: 20.20.20.2
CSE 123: Computer Networks
Homework 4
Out: 11/25, Due: 12/02
Instructions:
1. Turn in a physical copy at the beginning of the class on 11/18.
2. Ensure the HW cover page has the following information clearly written:
a. Name
b. UCSD email
c. PID
3. Please contact the TAs or post on Piazza to seek any clarification.
4. The homework is to be done individually.

1. Fair Queuing
Consider a router that is managing three flows, on which packets of constant size arrive at the
following wall clock times:
Flow A: 1, 2, 4, 6, 7, 9, 10
Flow B: 2, 6, 8, 11, 12, 15
Flow C: 1, 2, 3, 5, 6, 7, 8

All three flows share the same outbound link, on which the router can transmit one packet per time
unit. Assume that there is an infinite buffer space.
a) Suppose the router implements fair queuing. For each packet, give the wall clock time when it
is transmitted by the router. Arrival times ties are to be resolved in the order of A, B , C. Note
that the wall clock time T = 2 is FQ-clock time A 1 = 1.5.
Wall A_{i} Arrivals (F_i) Sent A's Queue B's C's Queue
Clock Queue
1 1 A1(2), C1(2) A1 A1 C1
2 1.5 A2(3), B2(2.5), C2(3) C1 A2 B2 C1, C2
3 1.833 C3(4) B2 A2 B2 C2, C3
4 2.166 A4(4) A2 A2, A4 C2, C3
5 2.666 C5(5) C2 A4 C2, C3, C5
6 3.166 A6(5), B6(4.166), A4 A4, A6 B6 C3, C5, C6
C6(6)
7 3.5 A7(6), C7(7) C3 A6, A7 B6 C3, C5, C6,
C7
8 3.833 B8(5.166), C8(8) B6 A6, A7 B6, B8 C5, C6, C7,
C8
9 4.166 A9(7) A6 A6, A7, A9 B8 C5, C6, C7,
C8
10 4.5 A10(8) C5 A7, A9, B8 C5, C6, C7,
A10 C8
11 4.833 B11(6.166) B8 A7, A9, B8, B11 C6, C7, C8
A10
12 5.166 B12(7.166) A7 A7, A9, B11, B12 C6, C7, C8
A10
13 5.5 - C6 A9, A10 B11, B12 C6, C7, C8
14 5.833 - B11 A9, A10 B11, B12 C7, C8
15 6.166 B15(8.166) A9 A9, A10 B12, B15 C7, C8
16 6.5 - C7 A10 B12, B15 C7, C8
17 6.833 - B12 A10 B12, B15 C8
18 7.166 - A10 A10 B15 C8
19 7.5 - C8 B15 C8
20 8.0 - B15 B15

b) Suppose the router implements weighted fair queuing, where flows A and B are given equal
share of the capacity, and flow C is given twice the capacity of flow A. For each packet, give
the wall clock time when it is transmitted.

Wall A_{i} Arrivals (F_i) Sent A's Queue B's C's Queue
Clock Queue
1 1 A1(2), C1(1.5) C1 A1 C1
2 1.5 A2(3), B2(2.5), C2(2) A1 A1, A2 B2 C2
3 1.833 C3(2.5) C2 A2 B2 C2, C3
4 2.166 A4(4) B2 A2, A4 B2 C3
5 2.5 C5(3) C3 A2, A4 C3, C5
6 3 A6(5), B6(4.0), A2 A2, A4, A6 B6 C5, C6
C6(3.5)
7 3.333 A7(6), C7(4.0) C5 A4, A6, A7 B6 C5, C6, C7
8 3.666 B8(5.0), C8(4.5) C6 A4,A6, A7 B6, B8 C6, C7, C8
9 4.0 A9(7) A4 A4, A6, B6, B8 C7, C8
A7, A9
10 4.333 A10(8) B6 A6, A7, B6, B8 C7, C8
A9, A10
11 4.666 B11(6.0) C7 A6, A7, B8, B11 C7, C8
A9, A10
12 5.0 B12(7.0) C8 A6, A7, B8, B11, C8
A9, A10 B12
13 5.333 - A6 A6, A7, B8, B11,
A9, A10 B12
14 5.833 - B8 A7, A9, B8, B11,
A10 B12
15 6.333 B15(8.0) A7 A7, A9, B11,
A10 B12, B15
16 6.833 - B11 A9, A10 B11,
B12, B15
17 7.333 - A9 A9, A10 B12, B15
18 7.833 - B12 A10 B12, B15
19 8.333 - A10 A10 B15
20 8.833 - B15 B15
2. RED
Consider a RED gateway with MaxP = p and with an average queue length halfway between the two
thresholds.
a) Calculate the probability that none of the first n packets is dropped.
tempP = p/2 (since avg length is half-way)
p/2
Probability of drop of 1st packet = P1 =
1− p/ 2
p/2
Similarly, P2 =
1− p
p/2
and hence Pi =
1−i∗p /2
Probability that none of the first n packets are dropped =
(1−P1 )∗(1−P2 )∗....∗(1−P n)
1−(n+1) p/2
Solving the expression, we get
1− p /2
b) Find p such that the probability that none of the first n packets is dropped is α .

1−(n+1) p/2

1− p /2
Solving this, we get p=2(1−α)/(n+1−α )

3. Token bucket
The transmission schedule (Table 1) for a given flow lists for each second the number of packets sent
between that time and the following second. The flow must stay within the bounds of a token bucket
filter. What bucket depth does the flow need for the following token rates? Assume the bucket is
initially full.
a) 2 packets per second
In this problem, we assume that if packets arrive at t = t, then they need to be
sent out at least by t=t+1 so, we get the 2 tokens replenished before we send the
packets for that second out.

Time(seconds) Packets sent #tokens present Final tokens


0 6 B B-6+2 = B-4
1 4 B-4 B-4-4+2 = B-6
2 2 B-6 B-6-2+2 = B-6
3 0 B-6 B-6-0+2 = B-4
4 7 B-4 B-4-7+2 = B-9
5 1 B-9 B-9-1+2 = B-8

To keep the number of tokens in the bucket >= 0, we need B to be atleast 9.

b) 4 packets per second

Time(seconds) Packets sent #tokens present Final tokens


0 6 B B-6+4 = B-2
1 4 B-2 B-2-4+4 = B-2
2 2 B-2 B-2-2+4 = B
3 0 B B = B (can't add
more)
4 7 B B-7+4 = B-3
5 1 B-3 B-3-1+4 = B
This time B should be at least 3.

Time(seconds) Packets sent


0 6
1 4
2 2
3 0
4 7
5 1
Table .1

4. AIMD
Suppose a connection starts with cwnd=1 and increments cwnd by 1 each RTT with no loss, and sets
cwnd to cwnd/2, rounding down, on each RTT with at least one loss. Assume that the propagation
delays dominate so each windowful is sent more or less together. Packets 5, 13, 14, 23 and 30 are lost.
Lost packets are retransmitted and the retransmitted packets are not lost again.
a) What is the window size each RTT, up until the first 40 packets are sent?
b) What packets are sent each RTT?
This is assuming there is no caching at the receiver. Selective retransmission
could be done as well but the assumption needs to be stated.

Cwnd Packets sent RTT


1 1 1
2 2, 3 2
3 4, 5, 6 3
1 5 4
2 6, 7 5
3 8, 9, 10 6
4 11, 12, 13, 14 7
2 13, 14 8
3 15, 16, 17 9
4 18, 19, 20, 21 10
5 22, 23, 24, 25, 26 11
2 23, 24 12
3 25, 26, 27 13
4 28, 29, 30, 31 14
2 30, 31 15
3 32, 33, 34 16
4 35, 36, 37, 38 17
5 39, 40 18
Hint: in the first RTT, Data[1] is sent. There is no loss, so in the second RTT cwnd = 2 and Data[2]
and Data[3] are sent.

5.TCP Reno
Assumptions:
1. each segment is of size 1 byte and Data[N] represents a segment (or a byte).
2. dupACK[M]/N represents duplicate ACK sent for byte (or segment) M triggered byte (or
segment) N.
Suppose the window size is 100, and Data[1001] is lost. There will be 99 dupACK[1000]’s sent, which
we may denote as dupACK[1000]/1002 through dupACK[1000]/1100. TCP Reno is used.
a) At which dupACK[1000]/N does the sender start sending new data?
The sender will send new data that is Data[1101] after it has retransmitted
Data[1001]. The retransmission will happen after the receipt of the 3rd
duplicate ack for data[1000]. Clearly the third dupACK is sent in response to
Data[1004]. Before retransmission the window size cwnd is halved as well. So
current cwnd = 50 and data in flight = 100-3 = 97 (-3 for the three dupACKs).
To be able to send anymore data (basically Data[1101]), we need
◦ the inflight data < cwnd.
◦ and for each dupACK received, the inflight data reduces by 1 and cwnd
increases by 1 (since TCP Reno increases sender's window by 1 for each
dupACK received).
Let n = # of inflight data = 97 as seen above.
cwnd = initial sender window = 50 (after halving it)
(53 according to rfc 2001. Either is okay)

n – x < cwnd + x

(To find the x dupACKs that we need to receive so that inflight packets are less
than the then sender window size allowing us to send the new Data i.e., Data[1101])
=> x > (n-cwnd)/2
=> x > (97-50)/2
=> x = 24.

So 24 more dupACKs are needed which will come as ACKs for Data[1005],
Data[1006] ...... till Data[1029].
The moment we get the dupACK[1000]/1029, the sender window would have an empty slot
letting us send Data[1101].

b) When the retransmitted data[1001] arrives at the receiver, what ACK is sent in response?
When Data[1001] arrives at the receiver, all the packets from 1001 till 1100
would have been received and hence, receiver would send ACK for Data[1100] in
case of selective retransmission.
If no caching at the receiver, then it will ACK only Data[1001].
c) When the acknowledgment in (b) arrives back at the sender, what data packet is sent?
The moment retransmission happens, the sender window is halved and hence, the
window becomes 50. After the retransmission, there are 100-3 packets in
flight and 96 more dupACKs are on their way to the sender dupACK[1000]/1005,
dupACK[1000]/1006.......dupACK[1000]/1100. For each dupACK received, the
window size is increased by 1 so when dupACK[1000]/1100 is received, the
window size will be 50 + 96 = 146.

Assuming selective retransmission, after the reception of the last dupACK,


the window looks something like this......
1001 1101 1102 1103 . . . . . 1101+146-1
(retransmitted) = 1246

Now once Data[1001] gets acknowledged, Data[1247] will be sent.

If you do not assume selective retransmission, all the 99 bytes Data[1002] till
Data[1100] will be retransmitted. In that case, the window after the reception of
the last dupACK will looks like...

1001 1002 1003 1004 . . . . . 1001+146


(retransmitted) = 1147
So, once Data[1001] gets acknowledged, Data [1148] will be sent.
4. (15 pts) IP forwarding. Consider the forwarding and (partial) ARP tables below taken from a router
connected to four different networks on ports eth0, eth1, eth2, and eth3. The router uses the IP
addresses 192.168.32.2, 192.168.0.3, 192.168.6.1, and 192.168.7.1, on each of those networks, re-
spectively.

Destination Next Hop Interface


127.0.0.1/32 127.0.0.1 lo0
default 192.168.32.1 eth0
192.168.0.0/16 eth0
192.168.0.0/21 eth1
192.168.4.0/22 192.168.0.4 eth1
192.168.6.0/24 eth2
192.168.7.0/24 eth3

IP address MAC address


192.168.32.1 00:21:56:4a:38:00
192.168.32.2 ba:e8:56:24:88:00
192.168.0.4 78:31:c1:c5:7c:48
192.168.0.3 00:50:56:c0:00:01
192.168.6.1 00:50:56:c0:01:F1
192.168.6.255 FF:FF:FF:FF:FF:FF
192.168.7.1 00:50:56:c0:73:d8

a) (5pts). Suppose the following Ethernet frame arrived at a router with the tables above. (Only a
subset of the header fields are shown.) Which entry in the forwarding table would it match?

Eth Src Eth Dst IP Src IP Dst Payload


00:21:56:4a:38:00 ba:e8:56:24:88:00 10.1.17.23 192.168.5.137 ...

192.168.4/22 192.168.0.4 eth1

b) (10pts). Assume that the packet is forwarded according to the tables above. What would the
following fields of the frame contain as it leaves the router?

Eth Src Eth Dst IP Src IP Dst Payload


00:50:56:c0:00:01 78:31:c1:c5:7c:48 10.1.17.23 192.168.5.137 ...

5
CSE123 Fall 2016 Homework #3 (abbreviated)
Instructor: Stefan Savage

Due Friday 11/26 at the beginning of class

1. IP addressing

Consider the IPv4 address 128.239.253.6

a) Assuming we’re using class-based addressing, explain i) what “class” the


address is and ii) what is the address of the network part and iii) what is
the address of the host part

i) this is a class B address


ii) the network part is 128.239.x.x (saying 128.239 or 128.239/16 or
128.239.0.0/16 is fine too)
iii) the host part is 253.6 (or any reasonable description thereof)

b) Assume that we’re using classless (i.e., CIDR) addressing and the longest
matching advertised route cover this address is 128.239.128.0/17. As with
part “a” above explain i) what is the network part of the address and ii)
what is the host part

i) 128.239.128.0/17 (or anything that describes the first 17 bits of the


address)
ii) 111.6 (or anything that describes the last 15 bits of the address)

c) Inside the organization that owns this network (UCSD incidentally) they
further subdivide the host part of the address (from part b above) into a
subnet prefix and host address (let suppose the least significant 8 bits
represent the host and the remainder identifies the subnet inside CMU).
How many different LANs can be supported with this subnetting
architecture?

If there are 15 bits in the host part and 8 are used for hosts within a
subnet, then there are 7 bits for subnetting, or 128 distinct subnets
(I’m also ok with the answer 127 if they want to argue that the all 0
subnet won’t be allowed)
2. DV Routing
Consider the following network using distance vector routing:

Suppose an additional link is added connecting A and D with cost 2. List the distance vector
updates that will be sent for the system to reconverge (the first update, from A, is listed
below). Assume that updates occur simultaneously in rounds (i.e., at a set time each node
transmits their distance vectors to their neighbors). You only need list DV updates in a route
that have changed since the last round. [also: ignore split horizon or poison reverse in this
example]

Round 1:
A: 0, 6, 5, 2, 1 (reflecting only the change in the AD link)
D: 2, 3, 2, 0, 2 (reflecting only the change in the AD link)
Round 2:
A: 0, 5, 4, 2, 1 (A’s cost to B and C is updated by D’s vector from round 1)
C: 4, 1, 0, 2, 4 (C’s cost to A is updated by D’s vector from round 1)
Round 3:
B: 5, 0, 1, 3, 5 (B’s cost to A is updated by C’s vector from round 2)
Done
3. Link State Routing
For the network show, complete the table below showing how the link-state algorithm builds
the routing table for node D. Assume all link-state updates have been distributed (i.e., this is
just the shortest path algorithm calculation) The syntax used below is as follows:
(destination, distance, via which node)

5
A C
8

12 2 F
B
3

D E
4

Confirmed Tentative

1. (D, 0, -) (A, 12, A) (E, 4, E)

2. (D, 0, -) (A, 12, A) (B, 7, E) (C, 6, E)


(E, 4, E)

3. (D, 0, -) (A, 11, E) (B, 7, E) (F, 14, E)


(E, 4, E)
(C, 6, E)

4. (D, 0, -) (A, 11, E) (F, 14, E)


(E, 4, E)
(C, 6, E)
(B, 7, E)

5. (D, 0, -) (F, 14, E)


(E, 4, E)
(C, 6, E)
(B, 7, E)
(A, 11, E)

6. (D, 0, -)
(E, 4, E)
(C, 6, E)
(B, 7, E)
(A, 11, E)
(F, 14, E)
CSE123 Fall 2016 Homework #4
Instructor: Stefan Savage

Due Friday 12/2 at the beginning of class

1. TCP performance

a) Consider a standard TCP implementation using flow control, slow start


and AIMD-style congestion control. A TCP-based application wishes to
send 100KB to a receiver. The bottleneck link between the sender and
receiver is 10Mbps and there is no competing traffic. The round-trip time
is 100ms and the packet size is 1KB. The receiving application reads
10KB of data every second and has 100KB of buffer. Will this transfer
saturate the bottleneck link? If so, explain why. If not, explain why not.

No. There is no flow control problem because there is enough buffer


to accept the whole 100KB. However, to max out the link would
require a window equal to the bandwidth*delay product (BDP),
10Mbps*100ms. Since there is no flow control limitation we need
cwnd=125KB. Due to slow start, the sender will send 1KB, then 2KB,
4KB, 8KB, 16KB, 32KB then 37KB. Cwnd will never reach 125KB
and hence the sender will never send fast enough to saturate the
10Mbps link.

b) What if the receiver buffer were set to 200KB?


No. this won’t matter because there is no flow control limitations in
this example.

c) What if the round-trip time was 1ms?


Yes. In this case, the BDP would be 1250bytes, barely more than one
packet and we will reach this quickly (after one RTT). At this point
we’ll be injecting data into the network at a rate of at least 2000bytes
per 1ms (or 16Mbps) which will exceed the capacity of the link.
2. Transport behavior
Consider a TCP session for which the current window size is 10,000 bytes and
the MSS (the number of maximum bytes in a packet) is 1,000 bytes. Suppose
the sender sends 5,000 bytes. In return it receives several acknowledgements
(assume for this example that sequence numbers start at 1). It receives an
ACK for byte 1001, then another for byte 2001, then another for byte 2001,
then another for byte 2001… and that’s it (four acks)
a) Describe two possible explanations for this sequence of packets (i.e., what
could have happened in terms of which packets were delivered, in what
order and which packets were lost)

i) the third packet was lost (from bytes 2001-3000), but the fourth and
fifth packets were delivered. All ACKs were delivered.
ii) the fourth and fifth packets were delivered before the third packet
AND the acknowledgement for the third packet (which would have
been for byte 5001) was lost.

b) Suppose you send another 1000 byte packet (i.e., for bytes 5001-6000) and
receive an acknowledgement in response. How would the contents of that
acknowledgement let you distinguish between the two cases above?

If the ack was for byte 6001 then you could conclude that the third
packet really was delivered. If the ack was still for byte 2001 then you
know that the third packet was not delivered.

3. Flow control
Consider a TCP connection with a 1ms round-trip time in which the sender
has 50,000 bytes of data to send and there are no losses and no congestion.
The receiver has an initial advertised window of 10,000 bytes and reads 2,000
bytes of data once every two seconds. Answer the following questions with a
number and a sentence explaining why.
i) What is the advertised window after one second?

0, because 10000 bytes are buffered and the receiver has not yet
read.

ii) What is the advertised window after two seconds?

2000 because the receiver just read 2000 bytes and so the sender
can send another 2000.

iii) What is the advertised window after fifty seconds?


10000 because after fifty seconds all 50KB will have been
transferred AND consumed and thus the receiver’s buffer will be
empty.
IGURE 3.10 Extended LAN with loops.

3. (15 pts) Bridging. Consider the extended LAN shown below.

a) (5pts). Indicate which ports are not selected by the spanning tree algorithm.

Copyright © 2012, Elsevier Inc. All rights Reserved


B7’s port to network B, B3’s ports to network A and C, and B6’s ports to I and G will be
disabled.

b) (10pts). What happens if bridge B2 fails? Why (i.e., what messages will/will not be exchanged)?

B3’s ports will be re-enabled because B3 will stop receiving announcements from B2 and
instead will become “best” for network C.

5
4. (40 pts) IP forwarding. Consider the network diagram below. Each router (a square in the figure)
is labeled with the names of its interfaces (e.g., eth0) and the IP addresses assigned to each. Each
network (a circle) is labeled with its network name and prefix length.

R2

192.168.1.1

192.168.1.3
eth0

187.200.4.129
A eth3 R1 eth1
187.200.4.1
C

eth2
187.200.4.128/26 187.200.4.193 187.200.4.0/25

187.200.4.192/26

The forwarding table at R1 contains the following entries:

Destination Next Hop Interface


127.0.0.1/32 127.0.0.1 lo0
default 192.168.1.1 eth0
192.168.1.0/24 eth0
187.200.4.0/25 eth1
187.200.4.192/26 eth2
187.200.4.128/26 eth3

6
a) (5pts). Suppose the following IP packet arrived at a router R1. (Only a subset of the header
fields are shown.) Which entry in the forwarding table would it match?

IP Src IP Dst Payload


187.200.4.165 187.200.4.83 ...

187.200.4.0/25 eth1

b) (5pts). On which port on R1 must the packet above have arrived?

eth3

c) (10pts). How many hosts can network C accomodate (assuming unique IP addresses were the
only constraint)?

27 −3 = 125; as the all-zeros address is reserved for the network name, the all-ones address
is reserved for broadcast, and one address is used by the router’s interface.

d) (10pts). What is a legal IP address for a host on network B?

Any address between 187.200.4.194 and 187.200.4.254 is fine (187.200.4.193 is used by the
router).

e) (10pts). Imagine R2 uses aggregation to maintain precisely one entry in its forwarding table to
describe networks A, B, and C. What would that entry look like? (Give both the network name
including prefix length and the next hop.)

Destination Next Hop Interface


187.200.4.0/24 192.168.1.3 ...

7
0 0 1 0 1 1 0 1

0 0 1 0 1 0 0 0

0 1 1 1 1 1 0 1

0 1 1 0 1 0 0 1

1 1 0 0 0 1 0 1

0 0 1 0 1 0 1 1

1 1 0 0 0 0 0 0

0 0 0 1 0 0 1 0

2. Maximum Throughput

Consider a 10Mbps link with a 20-ms round-trip time (RTT). Assume that the
sender can send only one frame per RTT, and that the sender has a frame
size of 5 KB. Calculate:-

a. The Bandwidth-Delay Product of the channel (1 point)

The Bandwidth-Delay product of a channel is defined


as the product of the bandwidth of the channel and
its associated round-trip time (RTT). In this case,
the Bandwidth-Delay product will be

10 Mbps X 20 ms = 200 Kb

b. The maximum throughput the sender can achieve (1 point for getting
the numerator and denominator values right, 1 point for final
answer)

The maximum throughput of the channel is calculated


by dividing the maximum amount of data that can be
sent every RTT with the value (in ms) of the RTT
5*210*8 b = 2.048 Mbps
20 ms

c. The fraction (or percentage) of the capacity of the link that is being
used by the sender. (1 point)

The fraction of the capacity being used by the


sender can be calculated as follows

2.048 Mbps = 20.48%


10 Mbps

3. The HDLC Protocol

Given our understanding of the HDLC protocol, assume that the following bit
stream arrives at the receiver at a particular instant of time:-

0111 1111 1001 1101 1011 0110 0111 1110 1111 0111 1111 0111 1111 0111
0110 1101 1011 1111 0100 0111 1000 0001 1110 1111 1101 1111 1110 0010
1111 0010 1101 0011 1111 1101 1101 1111 0110 0101 0011 1101 1111 1001

Calculate the total number of:-

a. Correctly received end of frames (1 point for each correctly


identified EOF, no negative penalty otherwise)

0111 1111 1001 1101 1011 0110 0111 1110 1111 0111 1111 0111 1111 0111
0110 1101 1011 1111 0100 0111 1000 0001 1110 1111 1101 1111 1110 0010
1111 0010 1101 0011 1111 1101 1101 1111 0110 0101 0011 1101 1111 1001

The total number of correctly received end of frames is 4

a. Stuffed 0’s (1 point for each correctly identified stuffed 0, no


negative penalty otherwise)
6. The Automatic Repeat Request (ARQ) Protocol

Assume that two computers are communicating using the stop-and-wait ARQ
protocol. Assume that the RTT for the communication channel is 2ms, and
that the timeout is twice the RTT. Also assume that both parties use sequence
numbers on data and ACK frames. If the sender has to send 8 frames to the
receiver, draw the sequence of steps involved if the first 3 frames are sent
without incident (as shown in the figure) and the following takes place:-

a. The 4th frame is lost during the first and second transmission, but is
acknowledged without incident after the third transmission. (1 point)

The following diagram represents the above scenario


b. The 5th frame is lost during the first transmission, but acknowledged
without incident after the second transmission. (1 point)

The following diagram represents the above scenario

c. The 6th frame is sent and acknowledged without incident. (1 point)

The following diagram represents the above scenario


d. The 7th frame is sent without incident but the acknowledgment is lost
the first time; sent without incident during the second transmission. (1
point)

The following diagram represents the above scenario

e. The 8th frame is sent and acknowledged without incident. (1 point)

The following diagram represents the above scenario


Also, how much time (in ms) did it take for the above 8 frames to be
transferred and acknowledged successfully? (1 point)

From the above diagrams, it can be seen that the total


time it took for the frames to be transferred
acknowledged successfully is 32 ms.
CSE 1 23: Computer Networks
Homework 2
Out: 10/18, Due: 10/25
Total Points: 47.5

1. The Sliding Window Protocol

Assume that the sender’s window size is 3. If we have to send 10 frames in


total, and the channel of transmission is such that every 5th transmission is lost
(but no ACKs), how many data transmissions (including both original
transmissions and any necessary retransmissions) does the sender make in total
if:-
a. The go-back-N protocol is followed (2 points)
b. The selective repeat protocol is followed (2 points)
Also, calculate the ratio of the effective number of frames sent to the total
number of frames sent in each of the above cases. (2 points – 1 point for each
protocol)

In this problem, for every 5th frame that is trying


to be sent from the sender to receiver, an error in
transmission occurs, and the frame is lost.

a. Given below is a diagram showing the sequence of


transmissions from the sender to the receiver. The
go-back-n protocol is followed, and every 5th frame
transmitted is lost.
It can be seen that in order to transmit 10 frames of
data from the sender to the receiver, 18 frames in
total were sent. Hence the efficiency of the
transmission is 10/18 = 55.55%.

b. Given below is a diagram showing the sequence of


transmissions from the sender to the receiver. The
selective repeat protocol is followed, and every 5th
frame being transmitted is lost.
It can be seen that in order to transmit 10 frames of
data from the sender to the receiver, 12 frames in
total were sent. Hence the efficiency of the
transmission is 10/12 = 83.33%.

2. Learning Bridges

Consider the following topology, consisting of hosts A-H attached to learning


bridges B1-B3, with their corresponding port numbers marked as shown.

If the following sequence of steps is followed, identify all the hosts that receive
each message, assuming that the tables are empty for all bridges in the initial
state.
a. A sends a message to B (1 point)
b. B sends a message to A (1 point)
c. D sends a message to G (1 point)
d. E sends a message to D (1 point)
e. G sends a message to D (1 point)
f. H sends a message to F (1 point)
g. F sends a message to B (1 point)

Also, draw a simple forwarding table for each bridge after the above messages
have been sent. (3 points – 1 point for each bridge)
a. If A sends a message to B, all hosts receive it.
b. If B sends a message to A, hosts A, B and C will receive it.
c. If D sends a message to G, all hosts will receive it
d. If E sends a message to D, hosts D and E will receive it
e. If G sends a message to D, D, E, F, G, and H will receive it
f. If H sends a message to F, all hosts will receive the message
g. If F sends a message to B, all hosts will receive the message
The forwarding table maintained by each bridge will look like
this:-

B1 B2 B3

Host Port Host Port Host Port


A 1 A 3 A 6
B 1 D 4 D 6
D 2 E 4 F 7
F 2 F 5 G 7
H 2 H 5 H 7
G 5

3. The Spanning Tree Protocol

Consider the following network topology, where B1-B5 represent bridges, with their
respective ports numbered.

Using the spanning tree algorithm, find out the ports that will remain and the ports that will
be turned off, and draw the resultant spanning tree. Provide an explanation for how the tree is
formed; including -- selecting the root node, sending configuration messages to its neighbors,
and the cascading of messages between the bridges. Make sure to show the final
configuration message each bridge will send, and explain which ports will be switched off.
(10 points - 1 point each for each bridge’s configuration message, 1 point each for an
explanation for the same)

The following is an explanation of how the spanning tree is


formed for this network:-

1. The spanning tree algorithm uses the bridge with the


lowest ID as root. In this case, the root corresponds to
B1. Therefore, all of B1’s ports will be a part of the
final spanning tree.

2. Each node sends periodic configuration messages to each


other in the form of a tuple of order
(RootID, Distance to root, Bridge ID).
Therefore, B1 sends the configuration message (B1,0, B1)
to its neighbors B2 and B3 through ports 1 and 2
respectively.

3. B2 and B3 receive the above configuration message. Even


though these bridges may have believed themselves to be
the root bridge prior to this, B1 will now become their
root node as they have received a configuration message
with a ‘better’ root (as it has a lower ID number). B2
adds 1 to the distance advertised by B1 and sends (B1, 1,
B2) to its neighbor B5 through port 5. B3 does the same
and sends (B1, 1, B3) to its neighbors B4 and B5 through
port 10.

4. Since B5 receives messages from both B2 and B3, it will


select B2 as its parent node as it has the lower ID
number and will stop forwarding messages on ports 6 and 9
when it receives configuration messages from B4 and B3
respectively. Port 5 will switch off too, as the
designated port for the LAN connected to B2 and B5 will
be port 4 of bridge B2. The rest of the ports will
continue to function, thereby removing the cycles in the
graph.

5. The final configuration message each bridge will


periodically send will be the following:-
B1 – (B1, 0, B1)
B2 - (B1, 1, B2)
B3 – (B1, 1, B3)
B4 – (B1, 2, B4)
B5 – (B1, 2, B5)

Hence, the resulting spanning tree looks like this:-


4. Fragmentation

Suppose a router receives an IP packet of 552 bytes, and has to fragment the packet and
forward the fragments across a network with an MTU of 300 bytes. Then, a subsequent router
has to further forward the packet (and/or any resulting fragments) onto another network that
has an MTU of 100 bytes. Here, the MTU refers to the size of the largest packet that can be
carried in a link-layer frame. If the size of the TCP header is 20 bytes and that of the IP
header is also 20 bytes (i.e., there are no options), compute the values for the following fields
in the IP headers for all of the fragments that traverse each network:-
a. Length (5 points – 0.5 points for each of the 10 fragments)
b. MF (2.5 points - 0.25 points for each of the 10 fragments)
c. Offset (5 points – 0.5 points for each of the 10 fragments)

Consider the first network. Since the MTU is the size of the largest
IP packet that can be carried, which is 300B, the maximum allowable
payload is 280B.
Now, the payload that we need to send is 552B - 20B = 532B. Hence,
the message is fragmented into two - one of size 280B + 20B = 300B
and the other of size (532B - 280B = 252B) + 20B = 272B (because
each fragment needs its own header). The fields in the IP header for
the first packet are:-
a. Length = 300
MF = 1
Offset = 0

And that for the second packet are:-


b. Length = 272
MF = 0
Offset = 35

Offset has a value of 35 since the 280B offset is divided by 8 to


fit into a field of 13 bits instead of 16.

Now, consider the second network, wherein the MTU is only a 100B.
Hence, the maximum amount of payload data will be 100B - 20B = 80B.
Therefore, the fragment of size 300B, that contains 280B payload
data, will be further fragmented into fragments of size 100B, 100B,
100B, and 60B. The corresponding field values are as follows:-
a. Length = 100
MF = 1
Offset = 0

b. Length = 100
MF = 1
Offset = 10

c. Length = 100
MF = 1
Offset = 20

d. Length = 60
MF = 1 (as the MF bit of the fragment was originally 1)
Offset = 30

The second fragment of size 272B will be further fragmented into


fragments of size 100B, 100B, 100B, and 32B. The corresponding field
values are as follows:-
a. Length = 100
MF = 1
Offset = 35 (as the offset of the fragment was originally 35)

b. Length = 100
MF = 1
Offset = 45

c. Length = 100
MF = 1
Offset = 55

d. Length = 32
MF = 0
Offset = 65

5. Sequence Number Wraparound


Assuming that the Transmission Control Protocol (TCP) operates over a 2 Gbps link:-

a. If TCP could utilize the full bandwidth of the link, assume that it chooses to send segments
of 20B of data each, back-to back without any delay whatsoever. Also assume that there is no
error in the channel, and there is no retransmission of packets. Taking into account that the
size of the TCP header is 20 bytes, and ignoring other packet/frame headers or any other
overhead from the network and link layers, how long would it take for the TCP sequence
space to wrap around completely? (5 points - 3 points for effective bandwidth utilization, 2
points for final answer)
b. If the maximum segment lifetime (MSL) is 2 minutes for the network, is there a potential
for TCP to operate incorrectly? Why? (4 points - 1 point for answer, 3 points for
explanation)
a. The given bandwidth is 2 Gbps. The TCP
includes a header of 20B with the 20B payload,
making the total message size 40B. Hence, the
fraction of effective bandwidth being utilized is
20/40 = 1/2. Therefore the effective bandwidth is

(1 / 2) * 2 Gbps = 1 Gbps

Now, since the sequence space for TCP is 32 bits,


the total time it takes for the sequence numbers
to completely wraparound is

232 * 8 bits = 34.36 seconds


1 Gbps

b. In order for data transmission across a network


to occur without faults, the wraparound time for the
TCP sequence number must exceed the MSL. Since the
calculated wraparound time 34.36s < 120s, there could
be scenarios at the receiver end where multiple
packets of the same sequence number could arrive.
This means that the receiver will only select one of
the packets and discard the rest of the seemingly
indistinct packets, although in reality, all the
packets have different payload data, making them
unique.
TCP overcomes this by adding a unique 32-bit
timestamp to extend the sequence space. A higher
timestamp for a packet will indicate that it was sent
by the sender more recently, and a lower timestamp
will indicate that it was sent less recently; thereby
making packets with the same sequence number unique
to the receiver.
CSE 123: Computer Networks
Homework 2
Out: 10/18, Due: 10/25
Total points - 50

Question 1

Consider the network shown below, wherein horizontal lines represent transit
providers and numbered vertical lines represent inter-provider links. Assume that
networks implement the standard BGP route-selection policy, e.g., preferring
shorter AS paths to longer ones.
(6 points in total;0.5 points for each AS path and 0.5 points for each set of
links)

a. Suppose that each network adopts a policy that, when choosing among
egress links to the next AS, outbound traffic is carried as far possible
within the current AS (so-called “cold potato routing”). What route and
links would packets traverse if:
1. A communicates with B
<P,Q> across link 1
2. E communicates with C
<S,Q> across link 3
3. D communicates with A
<R,Q,P> across links 4 and 1

b. Now, suppose that each network adopts a policy wherein outbound traffic
is routed to the closest link to the next AS in order to minimize the intra-
AS cost (so-called “hot potato routing”). What route and links would
packets traverse if:
1. B communicates with D
<Q,R> across link 4
2. A communicates with F
<P,S> across link 2
3. D communicates with A
<R,S,P> across links 5 and 2
For the purposes of this question, you may mention a route and links in the
following format - <ISP 1, ISP 2, ISP 3, ….> across links #, #, ...

Question 2

Suppose a router has the following forwarding table, and that the contents of the router
ARP cache are shown below. Describe what the router does (i.e., out of which interface
does it forward the packet, and what is the destination MAC address of the outgoing
frame) with a packet addressed to each of the following destinations:-
(8 points total; 1 point each for finding next hop interface, 1 point each for finding
MAC address of destination)
a. 128.96.39.10
b. 128.96.40.12
c. 128.96.40.151
d. 192.4.153.17

Routing table for R1


Network Name Netmask Next Hop

128.96.39.0 255.255.255.128 Interface 0

128.96.39.128 255.255.255.128 Interface 1

192.168.45.0 255.255.255.252 Interface 2

113.89.79.0 255.255.255.252 Interface 3

72.201.65.0 255.255.255.252 Interface 4

128.96.40.0 255.255.255.128 192.168.45.1

192.4.153.0 255.255.255.192 113.89.79.1

<default> 0.0.0.0 72.201.65.1

ARP table for R1


IP Address MAC Address

128.96.39.10 1C-6E-97-CF-08-DF
128.96.40.12 E9-E7-5E-9A-03-69

128.96.40.151 FD-BC-EE-7A-F1-B3

192.4.153.17 BC-C8-D0-58-3F-E5

192.4.153.90 B8-EF-9C-BA-F8-B5

192.168.45.1 46-F4-93-AF-86-B1

113.89.79.1 FC-01-31-42-FC-60

72.201.65.1 34-74-FC-72-A9-2B

22.231.5.9 75-E1-9B-43-CA-69

Apply each subnet mask on the address and if the subnet number matches
any entry in the subnet number entry, then use the entry in the Next
Hop column
a. 129.96.39.10 matches 128.96.39.0/25. Hence, the packet goes out
on Interface 0 to the destination. ARP resolution on the
destination’s IP address 128.96.39.10 gives the destination’s MAC
address 1C-6E-97-CF-08-DF.
b. 128.96.40.12 matches 128.96.40.0/25. The next hop is a router
that has an IP address of 192.168.45.1. 192.168.45.1 matches
192.168.45.0/30, which indicates it is on the network attached to
interface 2. ARP resolution on the next-hop IP address gives the
router’s MAC address 46-F4-93-AF-86-B1.
c. 128.96.40.128 matches only the default entry; next hop is a
router that has an IP address of 72.201.65.1, which the
forwarding table indicates is attached to interface 4. ARP
resolution on the router’s IP address gives the router’s MAC
address 34-74-FC-72-A9-2B.
d. 192.4.153.17 matches 192.4.153.0/25; next hop is 113.89.79.1,
which is on the network on interface 3. ARP resolution on the
next hop’s IP address gives the router’s MAC address FC-01-31-42-
FC-60.

Question 3

For the network shown below, provide a global distance-vector table, indicating the distance
from each node to all other nodes, when:-
a. Each node only knows the distances to its immediate neighbors
b. Each node has reported the information it had in the preceding step to its immediate
neighbors
c. Step (b) happens a second time
(9 points in total; 0.5 points for each node’s distance vector for each table.
-0.25 points if 2 entries are wrong, -0.5 point if 3 entries or more are wrong)

a. This is how the table looks initially, when each node only knows
the distance to its immediate neighbors
Information stored Distance to reach each node
at each node
A B C D E F

A 0 inf 3 8 inf inf

B inf 0 inf inf 2 inf

C 3 inf 0 inf 1 6

D 8 inf inf 0 2 inf

E inf 2 1 2 0 inf

F inf inf 6 inf inf 0


b. After the nodes report the information from (a) to its neighbors,
the table looks like this

Information stored Distance to reach each node


at each node
A B C D E F

A 0 inf 3 8 4 9

B inf 0 3 4 2 inf

C 3 3 0 3 1 6

D 8 4 3 0 2 inf

E 4 2 1 2 0 7

F 9 inf 6 inf 7 0

c. After the nodes once again report the information from (b) to its
neighbors, the table will look like this

Information stored Distance to reach each node


at each node
A B C D E F

A 0 6 3 6 4 9

B 6 0 3 4 2 9

C 3 3 0 3 1 6

D 6 4 3 0 2 9

E 4 2 1 2 0 7

F 9 9 6 9 7 0

Question 4

For the same network topology provided in the previous question, state how the link-state
algorithm would build the routing table for node D. To start you off, the first entry of the table for
D has been provided below; use this to get to the next step, and the next, and so on, to get the
final routing table for D.
(8 points in total; -0.25 points for each wrong entry in each of the columns in each step)
D Confirmed Tentative

1 (D,0,-)

D Confirmed Tentative

1 (D,0,-)

2 (D,0,-) (A,8,A)
(E,2,E)

3 (D,0,-) (A,8,A)
(E,2,E) (B,4,E)
(C,3,E)

4 (D,0,-) (A,6,E)
(E,2,E) (B,4,E)
(C,3,E) (F,9,E)

5 (D,0,-) (A,6,E)
(E,2,E) (F,9,E)
(C,3,E)
(B,4,E)

6 (D,0,-) (F,9,E)
(E,2,E)
(C,3,E)
(B,4,E)
(A,6,E)
7 (D,0,-)
(E,2,E)
(C,3,E)
(B,4,E)
(A,6,E)
(F,9,E)

Question 5

Suppose X, Y, and Z are ISPs, that have CIDR allocations 11.0.0.0/8, 12.0.0.0/8, and 13.0.0.0/8
respectively. Assume that each network has only one router and that the hosts on those
networks can refer to the router with the network’s name. Assume that each provider’s
customers initially receive address allocations that are a subset of the provider’s.
Suppose X has the following customers:-
a. Xa with allocation 11.247.0.0/16
b. Xb with allocation 11.224.0.0/12
And Y has the following customers:-
a. Ya with allocation 12.29.0.0/20
b. Yb with allocation 12.28.0.0/20
Then, compute the following:-
1. Give routing tables for Y and Z assuming all providers are connected to each other.
2. Now, if X is only connected to Y and Y is connected to Z, but X and Z are not connected,
provide routing tables for X, Y, and Z.
3. Suppose customer Xa acquires a direct link to Y, and Ya acquires a direct link to X, in
addition to existing links from part 2 of the question. Provide the routing tables for X and
Y.
For the purposes of this problem, you may neglect the default and localhost addresses for the
tables. Also, you needn’t bother about other local networks the next hop routers/customers are
attached to.
To get you started, here’s how the table for X will look like when all providers are connected to
each other (as given in part 1)
(13 points in total; -0.5 points for each wrong entry in each of the tables)
Address Next Hop

12.0.0.0/8 Y

13.0.0./8 Z

11.247.0.0/16 Xa

11.224.0.0/12 Xb

1. Y’s table

Address Next Hop

11.0.0.0/8 X

13.0.0./8 Z

12.29.0.0/20 Ya

12.28.0.0/20 Yb

Z’s table

Address Next Hop

11.0.0.0/8 X

12.0.0./8 Y

2. X’s table

Address Next Hop

12.0.0.0/8 Y

13.0.0.0/8 Y

11.247.0.0/16 Xa

11.224.0.0/12 Xb
Y’s table will be the same as in part 1

Z’s table

Address Next Hop

11.0.0.0/8 Y

12.0.0./8 Y

3. X’s table

Address Next Hop

12.0.0.0/8 Y

12.29.0.0/20 Ya

13.0.0.0/8 Y

11.247.0.0/16 Xa

11.224.0.0/12 Xb

Y’s table

Address Next Hop

11.0.0.0/8 X

11.247.0.0/16 Xa

13.0.0.0/8 Y

12.29.0.0/20 Ya

12.28.0.0/20 Yb

Question 6
Assume we have the following name servers, and the client requests for the IP address
resolution of cse123-a.fa17.ucsd.edu (not a domain name in the real world, by the way).
What is the reply that the root name server sends to the local DNS server? What are the steps
that are then followed in the DNS lookup to get the final address of the specified domain name?
Assume that the local DNS server performs a recursive lookup each time on the remainder of
the address, and that the IP address for cse123-a.fa17.ucsd.edu is 132.239.67.100.
(6 points in total; 0.5 points for IP address and 0.5 points for next name server for each
response by name servers, 0.5 points for each request by DNS server, 0.5 points for final
response to client)

The following figure shows the sequence of steps followed when


querying for the IP address of cse123-a.fa17.ucsd.edu
CSE 123: Computer Networks
Homework 4
Out: 11/27, Due: 12/4

Total – 48.5 points

Question 1

Assume that we have a token bucket shaper that has a replenishment rate r = 10 KBps,
an infinite maximum rate R, a bucket size b = 50 KB, and that the bucket starts off full.
Also assume that a sender emits 15KB-packets every 0.5 seconds in a periodic
manner, starting at t=0.5 seconds. For the purposes of this question you can assume
that if sufficient tokens are available, packets pass through the token bucket
instantaneously, otherwise they are queued until there are.
i. How many tokens are left in the bucket after 1.5 seconds? (3 points)
ii. How long will it take until packets start to be queued or dropped? (2 points)
iii. Now, presume the sender can send as much as they want, whenever they
want. If the token bucket is changed to enforce a maximum rate R of 20 KBps,
what would the maximum possible burst size be? (3 points)

i. At t = 0.5s, the number of tokens in the bucket is


(50 - 15) = 35 KB.
At t = 1.0s, the number of tokens in the bucket is
(35 - 15) + (10*0.5) = 25 KB.
At t = 1.5s, the number of tokens in the bucket is
(25 - 15) + (10*0.5) = 15 KB.
Therefore, after 1.5 seconds, 15KB worth of tokens are
left in the bucket. (Note here we equate KBps with KB,
contrary to earlier in the term. Answers assuming the
packet size unit KB = 2^1024 bytes while the
replenishment rate unit, KBps = 10^10 bytes per second,
are also accepted.)

ii. Since this is a token bucket shaper, packets will only be


queued, not dropped. Tracing the sequence of steps as
mentioned in part (a), packets will start queuing at t =
2.5s, as the number of tokens in the bucket at that point
in time will not be able to handle the incoming flow.

iii. The maximum possible burst size would be given by


b*R/(R-r)
After simple substitution, we get (50*20)/(20-10), which
is 100KB.

Question 2

Suppose a router has three input flows and one output. It receives the packets listed in
the following table all at the same time, in the order listed, during a period in which the
output port is busy but all queues are otherwise empty. Give the order in which the
packets are transmitted, assuming
a. Fair queuing (5 points in total; 0.5 points for calculation of each F , 1 point for final
i

transmitted sequence)
b. Weighted fair queuing(7 points in total; 0.75 points for calculation of each Fi, 1
point for final transmitted sequence)
You should assume that the link rate is 1 byte per second.

Packet Packet size Flow Weight


(in Bytes)

1 100 1 1

2 100 1 1

3 100 1 1

4 100 1 1

5 190 2 4

6 200 2 4

7 110 3 1

8 50 3 1

a. First we calculate the finishing times Fi. Fi is calculated


as Fi = Fi-1 + Pi (Ai=0 here as all packets arrive at the
router at the same time)
Packet Size Flow Fi

1 100 1 100

2 100 1 200

3 100 1 300

4 100 1 400

5 190 2 190

6 200 2 390

7 110 3 110

8 50 3 160

We send packets in increasing order of Fi, the order being


<1, 7, 8, 5, 2, 3, 6, 4>

b. Dividing the flows by their weights, we get the


following table

Packet Size Flow Weights Weighted Fi

1 100 1 1 100

2 100 1 1 200

3 100 1 1 300

4 100 1 1 400

5 190 2 4 47.5

6 200 2 4 97.5

7 110 3 1 110

8 50 3 1 160

We send the packets in increasing order of weighted Fi, the


order being
<5, 6, 1, 7, 8, 2, 3, 4>
Question 4

Suppose we have a router with three input ports and three output ports. Assume all of
the output ports operate at the same speed Assume that the blue-colored packets go
out on Output 1, red-colored packets go out on Output 2, and green-colored packets go
out on Output 3.

a. Assume that the switching fabric works fast enough such that it is able to take a
packet from each input queue and transfer it to the output in one clock cycle. Also
assume the scheduling time to be trivial. Assume a simple scheduling algorithm,
wherein:-
1. If input queue 1 is not empty, send packet at the head
2. If input queue 2 is not empty, send packet at the head unless the packet’s
corresponding output port is being used at that current clock cycle.
3. If input queue 3 is not empty, send packet at the head unless the packet’s
corresponding output port is being used at that current clock cycle.
Identify which packet(s) will be transferred at each clock cycle, and in the process,
compute the total number of clock cycles needed to output all the packets. (4.5 points in
total; 0.5 points for the correct packets that are sent in each clock cycle)

CC 1 - Input 1 sends red, Input 2 sends green


CC 2 - Input 1 sends blue, Input 2 sends red
CC 3 - Input 1 sends red, Input 2 sends green
CC 4 - Input 1 sends red, Input 2 sends blue
CC 5 - Input 1 sends green, Input 2 sends blue, Input 3 sends red
CC 6 - Input 3 sends blue
CC 7 - Input 3 sends green
CC 8 - Input 3 sends red
CC 9 - Input 3 sends green
Hence, it takes a total of 9 clock cycles to send the packets

b. Now assume that the input queues make use of a virtual output queue. What problem
that is faced in part (a) of the problem does this solve? A one line answer would do.
Also, assume the same scheduling algorithm as mentioned before, except that each
input queue has a virtual output queue that will be scheduled in the preference order of
blue, red,and green. Identify which packet(s) will be transferred at each clock cycle, and
in the process, compute the total number of clock cycles needed to output all the
packets. (7 points in total; 1 point for the correct packets that are sent in each clock
cycle, 1 point for mentioning head-of-line blocking)

This solution solves the head-of-line blocking problem.

CC 1 - Input 1 sends blue, Input 2 sends red, Input 3 sends green


CC 2 - Input 1 sends red, Input 2 sends blue, Input 3 sends green
CC 3 - Input 1 sends red, Input 2 sends blue
CC 4 - Input 1 sends red, Input 2 sends green, Input 3 sends blue
CC 5 - Input 1 sends green, Input 3 sends red
CC 6 – Input 2 sends green, Input 3 sends red

It takes a total of 6 clock cycles to send all the packets.

Question 5

Consider a RED gateway, where the probability that a packet is dropped when the
average queue size is equal to the maximum threshold size of the queue is 10%. Also
assume that at the moment the average queue length is a quarter of the distance
between the minimum threshold and the maximum threshold.
Now, calculate the following:-

a. The drop probability if the number of newly arrived packets in the queue is
i. 1
ii. 30
(5 points each; 3 points for arriving at the expression for Pcount, 1 point each for
substituting the value of count)
b. The probability that none of the first 10 packets are dropped (4 points; 2 points
for arriving at the telescopic product, 2 points for the final answer)
For the purposes of simplicity, you don’t have to compute the decimal value of the
fraction, i.e, find the answer as a fraction.

a. To calculate TempP, the following formula is used:-

TempP = MaxP X (AvgLen - MinThreshold)


(MaxThreshold - MinThreshold)

Since AvgLen is a quarter of the distance from the minimum


threshold (i.e, at the first quartile), the fraction in the
above equation will be 1/4, or 0.25. Multiplying that with
MaxP which is 10% will give a value of 0.025.
The drop probability is given by

 Pcount = TempP/(1 - count*TempP)


 Pcount = 0.025/(1 - count/0.025)
 1/(40 – count)

i. Since count = 1, Pcount = 1/(40 - 1) = 1/39


ii. Since count = 30, Pcount = 1/(40 - 30) = 1/10

b. To find the probability that none of the first 10 packets


are dropped, we need to find the telescopic product

(1-P1) * (1-P2) .... *(1-P10)

Where Pcount is calculated as above, i.e.

 Pcount = 1/(40 - count)


 1-Pcount = (39 - count) / (40 - count)

Which is given by:-


(38*39) * (37/38) * (36/37) * ……… * (29/30)

This is simplified to get the final fraction 29/39.


3. (30 pts) Consider the extended LAN shown below; circles correspond to bridges while squares are
hosts. Assume all bridges were just turned on and no frames have been sent.

A C

D E

B3

B4
H

F G B7

J
B9 B1
K

M N B2
L

a) (10 pts). Indicate on the figure which ports—if any—will be turned off in the final spanning tree.

B4 and B9’s southbound ports

b) (5 pts). What is the final configuration message being sent by B4?

(B4, 2, B1) is sent to B3.

c) (15 pts). Suppose the following frames (and only these frames) are sent in the order indicated.
For each frame, say which hosts will receive it.

Frame Recipients
A sends a message to L Everyone
H sends a message to A A, C, D, E, and H
M sends a message to H J, K, M, N, L, and H

4
4. (20 pts) Consider the IPv4 address 18.26.0.127.

a) Suppose that we were still using class-based addressing. What type of network would this IP
address be a part of?

Class A.

b) If the network administrator had decided to break the network in part a) into 32 different subnets,
what would the subnet mask of the subnet to which this IP address belongs be?

11111111.11111000.00000000.000000000 or 255.248.0.0

c) What is the subnet number (address) of the subnet to which this IP address would be attached?

18.24.0.0

d) Now suppose instead that we are using CIDR addressing instead of Class-based addressing and
subnets. What would the length of CIDR prefix for the physical network in part c) to which the
host were attached be?

/13.

5
5. The Automatic Repeat Request (ARQ) Protocol (4 Points)
A client and a server are transmitting data frames using the stop-and-wait ARQ protocol.
Assume Round Trip Time (RTT) is 6 ms; The client timeout is 8 ms; The server drops every
fourth transmission received from the client (server will not send acknowledgement for that data
frame); Sequence number is correctly encoded in every data and acknowledgement frame; The
client transmits the first frame at time 0.

a. How many frames has the client already transmitted when it receives an
acknowledgement of the 10th frame from the server? (2 Points)

13 frames. The 4th, 7th and 10th frame are transmitted twice.

b. Compute the time (in ms) when the client receives an acknowledgement of the 10th
frame from the server. (2 Points)

Total Time = RTT * Acknowledged Frames + Timeout * Retransmitted Frames


= 6 * 10 + 8 * 3
= 84 ms
CSE 123: Computer Networks
Homework 2 Solutions
Total Points: 30
Student Name:
PID:
UCSD email:

Instructions:
Turn in a physical copy at the beginning of the class on 10/26.

Problems:

1. Learning Bridges (7 Points)


Consider hosts A, B, C, D, E, F and learning bridges B1, B2, B3, B4, with their
corresponding port numbers marked as shown. Assume the forwarding tables are empty for
all the bridges. Also assume that entries added to each forwarding table do not have
timeout.

C E

5 11
1 3 4 6 10 12
A B1 B2 B4 F

2 7

8
9
B B3 D
9
a) If the following sequence of steps is followed, for each step, list all the bridges
that receive each message. (1 Point Each)
i. Host A sends a message to Host B.
B1, B2, B3 and B4 (Each bridge floods the message)

ii. Host E sends a message to Host A.


B1, B2 and B4. (When B2 receives message from B4, it searches for “A”
in its forwarding table and only forwards the message to B1)

iii. Host D sends a message to Host B.


B1, B2, B3 and B4. (No bridges know about B, so all bridges flood this
message)

iv. Host F sends a message to Host D.


B2, B3 and B4. (When B2 receives message from B4, it searches for “D”
in its forwarding table and only forwards the message to B3)

v. Host C sends a message to Host F.


B2 and B4. (When B2 receives message from C, it searches for “F” in its
forwarding table and only forwards the message to B4)

b) Fill the forwarding table for bridge B1, after the above 5 messages (from part a)
have been sent. (2 Points; 1 Point if write at least one correct pair)

B1 Forwarding Table

Host Port

A 1
D 3
E 3
Also B2, B3 and B4’s forwarding tables are listed below (Not Graded).

B2 Forwarding Table

Host Port

A 4
C 5
D 7
E 6
F 6

B3 Forwarding Table

Host Port

A 8
D 9
F 8

B4 Forwarding Table

Host Port

A 10
C 10
D 10
E 11
F 12
2. Spanning Tree Protocol (6 Points)

Consider the extended LAN topology shown below, where B1-B7 represent bridges, with their
corresponding ports numbered.

a) We denote a configuration message from node X in which it claims to be distance d


from root node Y as (Y, d, X). For example, the first configuration message sent by
bridge B7 is (B7, 0, B7). After the spanning tree algorithm converges, what are the
configuration messages sent by bridge B2, B3 and B7, respectively? (3 Points; 1
Point for each correct message)
B2: (B1, 1, B2)
B3: (B1, 3, B3)
B7: (B1, 2, B7)

b) Indicate which ports are deactivated by the spanning tree algorithm. (1 Points)

11, 16 and 17.

c) Now assume bridge B1 does not participate in the spanning tree algorithm and
drops all spanning tree algorithm messages.
(i) What is the new root bridge? (1 Point)
B2

(ii) Which ports are deactivated by the spanning tree algorithm? (1 Point)
11, 13 and 14. (Ports 1 and 2 should not be in the answer, but there are no
penalties if included)

3. IP Fragmentation (7 Points)
Suppose a router receives an IP packet. Some fields of the IP header of this IP packet are
shown as follow,

Length ID = MF = DF = Offset = TTL =


= 592 23 0 0 0 3

Now the router has to fragment this packet and forward the fragments across a network with an
MTU of 300 bytes. Here, the MTU refers to the size of the largest packet that can be carried in a
link-layer frame. If the size of the IP header is 20 bytes.
a) How many fragments will the router transmit? (1 Point)
3

b) For each fragment, list the values for the following fields in the IP headers: Length, ID,
MF, DF, Offset and TTL. Note that “Offset” field indicates position of current fragment (in
bytes/8). (6 Points; 2 Points for each frame with all correct values; 1 Point for each
frame that has partial correct values)

IP header of Fragment 1:
Length ID = MF = DF = Offset = TTL =
= 300 23 1 0 0 2

IP header of Fragment 2:
Length ID = MF = DF = Offset = TTL =
= 300 23 1 0 35 2

IP header of Fragment 3:
Length ID = MF = DF = Offset = TTL =
= 32 23 0 0 70 2
4. The Sliding Window Protocol (4 Points)
A sender and a receiver are transmitting data frames using the Selective Repeat Protocol.
Assume Round Trip Time (RTT) is 6ms. The sender has a timeout of 8ms. The sender’s window
size is 3. The receiver drops every 4th transmission received (receiver will not send
acknowledgement for that data frame); Sequence number is correctly encoded in all data and
acknowledgement frames. The sender and receiver can transmit multiple frames at the same
time. The sender transmits the first frame at time 0.

a) How many frames including duplicated ones, has the sender already transmitted when it
receives an acknowledgement of the 10th frame from the receiver? (2 Points)
15 or 13 (Assume the sender transmits at most 10 different frames)

b) Compute the time (in ms) when the sender receives an acknowledgement of the 10th
frame from the receiver. (2 Points)
Sender Receiver
Frame 1, 2, 3

RTT
ACK 1, 2, 3
Frame 4, 5, 6

TO ACK 5, 6

Frame 4
RTT ACK 4

Frame 7, 8, 9

TO ACK 8, 9

Frame 7
RTT ACK 7

Frame 10, 11, 12


ACK 11, 12
TO

Frame 10
RTT ACK 10

T = 4 * RTT + 3 * TO = 48ms
5. IP Addressing (4 Points)

Consider the IP address 192.168.213.214. Suppose that class-based addressing is applied.

a) What type of networks would this IP address be? (2 Points)

Class C

b) If the network administrator decides to break the network into 8 different subnets, what is
the subnet number (address) of the subnet to which this IP address would be attached?
(2 Points)

192.168.213.192
CSE 123: Computer Networks
Homework 3 (Due 11/16 in class)
Total Points: 33
Student Name:
PID:
UCSD email:

Instructions:
Turn in a physical copy at the beginning of the class on 11/16.

Problems:

1. IPv6 (4 Points)

(a) Convert the IPv4 address 192.160.213.213 into a mapped IPv6 address. (1 Point)

::FFFF:192.160.213.213 or ::FFFF:C0A0:D5D5

(b) Write the IPv6 address F999:0011:0000:0000:BBB0:0009:0000:9000 as succinctly as


possible. (1 Point)

F999:11::BBB0:9:0:9000

(c) Determine whether the following IPv6 address notations are correct (Circle One):
(1 Point each)

i) 7890::ACBD::4FF1:1012:11 Correct Incorrect

ii) 23::5550 Correct Incorrect


2. Address Resolution Protocol (7 Points)

Consider the IP network shown below, where R is a router and S is a switch. A, B, C and D are
hosts. IP addresses and MAC addresses of hosts and router interfaces are listed as follow.

Assume that router R has a complete and correct IP forwarding table, but its ARP cache is
incomplete, as shown below. ARP cache does not have timeout. Also assume that switch S has
a complete forwarding table.

ARP Cache of R
IP address MAC address
192.168.1.3 18:AB:AC:AD:AE:AF
10.2.2.2 02:EF:A1:A2:A3:A4

a) Suppose the following Ethernet frame arrives at the router R (Only a subset of the
frame is shown). Since the ARP cache of R is incomplete, R has to send ARP
requests to get the destination MAC address before forwarding the frame. Which
host(s) will receive this ARP request? (1 Point; No partial credit)

Ethernet Src Ethernet Dst IP Src IP Dst Payload


18:AB:AC:AD:AE:AF 3E:FF:28:29:30:31 192.168.1.3 20.2.3.2 …

Host C and D

b) Which host(s) will send an ARP reply corresponding to the ARP request in part a)?
(1 Point; No partial credit)

Host C
c) After the above steps are complete, what will the following fields of the frame contain
as it leaves R? (4 Point; 1 Point each)
Ethernet Src Ethernet Dst IP Src IP Dst Payload

3E:FF:38:39:40:41 01:FF:12:34:56:78 192.168.1.3 20.2.3.2

d) After the above steps are complete, another Ethernet frame arrives at the router R as
shown below (Only a subset of the frame is shown). Should R send another ARP
request, before forwarding this frame? Circle One. (1 Point)
Ethernet Src Ethernet Dst IP Src IP Dst Payload
02:EF:A1:A2:A3:A4 3E:FF:48:49:50:51 10.2.2.2 20.2.3.2 …

Yes No

3. Distance Vector (8 Points)

Consider the network shown below, where A, B, C and D are routers that run a distance-vector
routing protocol. Edges indicate costs between routers.

a. Complete the following global distance vector tables when,


i) Each node only knows the distances to its directly connected neighbors. (2 Points;
-1 point for each incorrect value)

Information Distance to Reach Node


Stored at Node A B C D
A 0 4 1 Infinite
B 4 0 2 3
C 1 2 0 Infinite
D Infinite 3 Infinite 0
ii) Each node has reported the information it had in the preceding step to its immediate
neighbors (2 Points; -1 point for each incorrect value)

Information Distance to Reach Node


Stored at Node A B C D
A 0 3 1 7
B 3 0 2 3
C 1 2 0 5
D 7 3 5 0

iii) Step (ii) happens a second time (2 Points; -1 point for each incorrect value)

Information Distance to Reach Node


Stored at Node A B C D
A 0 3 1 6
B 3 0 2 3
C 1 2 0 5
D 6 3 5 0

b. Suppose no mitigation strategies are applied, would count-to-infinite problem happens when,
(1 Point each)

i) The link between B and D failed (Circle One).

Yes No

ii) Instead of i), the link between A and C failed (Circle One).

Yes No
4. Link State Protocol (8 Points)

Consider the undirected graph below, where vertices are routers and edges represent a
weighted direct link between two routers.

All routers are running Link State Protocol to build their IP forwarding table. Router A is just
brought up so it only knows that its distance to B is 2, but nothing else. Then, A receives the
following Link State packets. The ID field is the node that creates the packet, and the Links field
is a list of directly connected neighbors of that node, with the cost of the link to each one.

Packet 1:
ID: D Links: [B, 3]; [E, 4]; [C, 1]

Packet 2:
ID: C Links: [B, 5]; [D, 1]; [E, 2]

Packet 3:
ID: E Links: [C, 2]; [D, 4]

Packet 4:
ID: B Links: [C, 5]; [D, 3]; [A, 2]

a) Complete the above graph by adding weighted edges. (3 Points; -1 point for each
missing or incorrect edge)

As shown above.
b) Referring to Table 3.14 of the Textbook (Page 258), Fill the routing table of Node A
below. (There may or may not be 10 steps)
(5 Points; -1 point for each wrong value in the last step; -1 point for each wrong
step other than the last step)

Step Confirmed Tentative


1 (A, 0, -)

2 (A, 0, -) (B, 2, B)

3 (A, 0, -); (B, 2, B)

4 (A, 0, -); (B, 2, B) (D, 5, B); (C, 7, B)

5 (A, 0, -); (B, 2, B); (D, 5, B) (C, 7, B)

6 (A, 0, -); (B, 2, B); (D, 5, B) (C, 6, B); (E, 9, B)

7 (A, 0, -); (B, 2, B); (D, 5, B); (C, 6, B) (E, 9, B)

8 (A, 0, -); (B, 2, B); (D, 5, B); (C, 6, B) (E, 8, B)

9 (A, 0, -); (B, 2, B); (D, 5, B); (C, 6, B);


(E, 8, B)

10
5. BGP routing (6 Points)

Consider the network shown below, in which horizontal lines represent providers (P1, P2 and
P3) or customers (C1, C2 and C3), and numbered vertical lines are links among providers and
customers. N1, N2, and N3 are networks connected to customer C1, C2 and C3, respectively.
Assume that the standard BGP route-selection policy is applied. A route can be represented as
a comma separated path from one provider/customer to another. For example, the route from
N2 to N3 through P3 can be written as <C2, P3, C3>.

a. List all valid routes that C1 knows to get to N2. Write N/A if there are none. (2 Points; -1
point for each missing or wrong path)

<C1, P1, C2>; <C1, P2, P1, C2>; <C1, P1, P3, C2>

b. List all valid routes that P2 knows to get to N3. Write N/A if there are none. (1 Point)

N/A

c. List all valid routes that C3 knows to get to N1. Write N/A if there are none. (1 Point; No
partial credit)

<C3, P3, P1, C1>

d. Suppose at some point link 7 failed, which provider(s)/customer(s) would receive a


corresponding update message from P1? (2 Points; -1 point for each missing or
wrong answer)

C1 and C2.
CSE 123: Computer Networks
Homework 4 (Due 12/03 in class)
Total Points: 30
Student Name:
PID:
UCSD email:

1. Random Early Detection (6 Points)


Consider a RED gateway, where the probability that a packet is dropped when the average
queue size is equal to the maximum threshold size of the queue is 12%. Also assume that at the
moment the average queue length is 2/3 of the distance between the minimum threshold and
the maximum threshold. For each question, please show your work.

(a) What is the drop probability if the number of newly arrived packets in the queue is 2?
(1 Point for correct steps; 1 Point for correct answer)

TempP = MaxP X (AvgLen - MinThreshold) / (MaxThreshold - MinThreshold)


= 0.12 * 2/3 = 0.08
Pcount = TempP / (1-count*TempP)

P2 = 0.08/(1-2*0.08) =0.095 (or 2/21)

(b) What is the drop probability if the number of newly arrived packets in the queue is 10?
(1 Point for correct steps; 1 Point for correct answer)

P10 = 0.08/(1-10*0.08) = 0.4

(c) Find n such that the probability that none of the first n packets is dropped is 1/23.
(1 Point for correct steps; 1 Point for correct answer)

let InvP = 1 / TempP = 1 / 0.08 = 12.5


1-Pcount = 1 - TempP / (1 – count * TempP) = (InvP - count -1) / (InvP- count).
(1) Assume count ranges from 0 to n-1 (precise interpretation),
(1-P0)(1-P1)…(1-Pn-1) = (InvP-n)/(InvP) = 1/23
Therefore, n = 12.

(2) Assume count ranges from 1 to n,


(1-P0)(1-P1)…(1-Pn-1) = (InvP-n-1)/(InvP-1) = 1/23
Therefore, n = 11.

Either n = 12 or 11 is a correct answer.


2. Token Bucket (6 Points)
Consider the transmission schedule table for a given flow as shown below. Values in the right
column represent the number of bits (in Kb) sent between the time in the left column and the
following second. For example, the first row in the table indicates that 3 Kb are transmitted in
the first 1 second. Note that a bit can be transmitted only when a token in the bucket is available.
The bucket has a depth of b and a replenishment rate of r, which are always positive. Assume
the bucket is initially full. For each question, please show your work.

Time Bits Sent


(seconds) (Kb)
0 3
1 4
2 2
3 5
4 1

(a) What is the minimum bucket depth b (in Kb) if r = 0.8 Kbps?
(1 Point for correct steps; 1 Point for correct answer)

Token cannot be negative, so we have


b-3+r >= 0; b-3-4+2r>=0; b-3-4-2+3r >= 0; b-3-4-2-5+4r >= 0; b-3-4-2-5-1+5r >= 0.
Plug in r = 0.8, we have b(r=0.8) >= 11Kb.

Therefore, b_min(r=0.8) = 11 Kb

(b) What is the minimum bucket depth b (in Kb) if r = 3.2 Kbps?
(1 Point for correct steps; 1 Point for correct answer)

Since the bucket cannot have more than b tokens, to transmit 5 Kb when t = 3, bucket
size must be at least 5-3.2 = 1.8 Kb.

Therefore, b_min(r=3.2) = 1.8 Kb

(c) What is the minimum replenishment rate r (in Kbps) if b = 9 Kb?


(1 Point for correct steps; 1 Point for correct answer)

Plug in b = 9, we have r(9=b) >= 1.25 Kbps

Therefore, r_min(b=9) = 1.25 Kbps


3. TCP Congestion Control (8 Points)
Consider the graph of TCP congestion window below, where the x-axis represents round-trip
times and the y-axis represents the size of TCP congestion window (maximum number of
unacknowledged frames allow). Assume that the timeout of each packet is three times of the
round trip time. At t = 0, the size of TCP congestion window is 1, and at t = 3, congestion
window size is 8. Therefore, the coordinates of A and B are (0, 1) and (3, 8), respectively. Also
known is that the y-coordinate of D is 10 and the x-coordinate of F is 22.

a) What are the coordinates of point C, D, E, F, G and H, respectively? (6 Points; -1 for


each wrong answer)

C: (4, 4) D: (10, 10) E: (11, 5)


F: (22, 16) G: (25, 1) H: (27, 4)

b) How many times did fast retransmit happen in the above graph? (1 Point)

c) How many times did slow start happen in the above graph? (1 Point)

2
4. QUEUING DISCIPLINES (6 Points)
Consider the network shown below. R1, R2 and R3 are routers and A, B, C, D and E are hosts.
The capacity (bandwidth) of each link (in Mbps) is numbered. Suppose A, B, C and D only send
packets to E while E does not send any packets.

(a) Based on this topology, what is the maximum throughput (in Mbps) that can be achieved
for the link between R3 and E? (2 Points)

20

(b) Suppose R1 receives the following packets in the order listed at about the same time.
Assume all queues are empty and large enough to keep all receiving packets. The
output port is busy.

Packet Size (bytes) Flow Weight


1 200 A 1
2 150 B 2
3 150 B 2
4 180 C 4
5 180 C 4
6 180 C 4
7 180 C 4

(i) Give the order in which these packets leave R1 if fair queuing is applied.
(2 Points; No partial credits)

<2, 4, 1, 3, 5, 6, 7>
(ii) Give the order in which these packets leave R1 if weighted fair queuing is applied.
(2 Points; No partial credits)

<4, 2, 5, 6, 3, 7, 1>

5. Signaling constraints (4 Points)


Suppose a channel has a bandwidth of 13 MHz. For each question, please show your work.

a. What is the minimum required signal-to-noise ratio (in dB) that could deliver an effective
bandwidth of at least 117 Mbps?

Applying Shannon’s Law,


SNR = 2C/B – 1 = 511
SNR(dB) = 10log10SNR = 27.1 dB

b. Now presume the channel is perfect—i.e., introduces no noise so the SNR is infinite. Is
it possible to achieve 125 Mbps using a digital encoding scheme with only 32 levels?

Applying Nyquist Theorem,


2Blog2M = 130 > 125.
Therefore, the channel can transmit 125 Mbps information.
3. (20 pts) Consider the IP network shown below, where R1, R2, and R3 are routers, A, B, and C are
networks with the given CIDR prefix, and each router interface has the IP address shown.

A 190.168.128/17

190.168.128.1

eth0

10.0.2.2 190.168.64.1
R1 eth0 eth3 R2 eth1 B
10.0.2.1
eth2
190.168.0.1 190.168.64/18

190.168.0.2

eth0

190.168.0.5
R3 eth1 C

190.168.0/18

a) A portion of R2’s forwarding table is shown below. Fill in the missing entries.

Destination Next Hop


127.0.0.0/8 loopback
default 10.0.2.1
10.0.2/24 eth3
190.168.0.0/30 eth2

190.168.0.0/18 190.168.0.2

190.168.64.0/18 eth1

190.168.128.0/17 eth0

b) What is the most concise way R1 can describe the network reachable through the next hop
10.0.2.2?

190.168.0/16

c) What class of network is the network in part b)?

Class B

d) What is the netmask a host on network C would use? Presuming network C is a subnet of the
network in part b), how many bits are used for the subnet number?

255.255.192.0, 2 bits

4
4. (30 pts) Consider the extended LAN shown below; circles correspond to learning bridges while
squares are hosts. Assume all bridges were just turned on and no frames have been sent.

K L

H J

B8

B4
G

B5 E F

B2

B9 B3
D

B6 B C
A

a) (10 pts). Indicate on the figure which ports—if any—will be turned off in the final spanning tree.

Both ports of B9, northbound port of B5

b) (5 pts). What is the final configuration message being sent by B6?

(B2, 2, B6)

c) (15 pts). Suppose the following frames (and only these frames) are sent in the order indicated.
For each frame, say which hosts will receive it.

Frame Recipients
D sends a message to C All hosts
G sends a message to C All hosts
L sends a message to D D, E, F, K and L

5
Question 3 Flow Control

A client and a server are transmitting data frames using the stop-and-wait ARQ protocol.
Assume Round Trip Time (RTT) is 6 ms; The client timeout is 8 ms; The server drops every
third transmission received from the client (server will not send acknowledgment for that data
frame); sequence number is correctly encoded in every data and acknowledgment frame;
The client transmits the first frame at time 0. (Here is a message exchange diagram for you
to understand what is happening)

3.1 Draw out the complete message exchange diagram until the client successfully
communicates (i.e., receives explicit acknowledgments for) 7 frames.

Solution Diagram in the next page


(Intentionally left blank for drawing)
3.2. How many frames has the client already transmitted, including retransmissions,
when it receives an acknowledgment of the 7th frame from the server?

1, 2, 3x, 3, 4, 5x, 5, 6, 7x, 7

10 frames. 3, 5, 7 would get dropped and transmit twice.

3.3. Compute the total time (in ms), including retransmissions, when the client
receives an acknowledgment of the 7th frame from the server.

3 time out and 7 regular round trip => 3 * 8ms + 7 * 6ms = 24 ms + 42 ms = 66 ms


Question 4 Transfer Layer Protocols
4.1 Present an example of usage of UDP and explain the benefit of it. Why TCP might be a
bad choice in this example?

Streaming service can use UDP. TCP provides correctness but for streaming service, TCP
will pause the delivery of the data while waiting for retransmissions of lost packets, leading to
jitter/stutter in the video display. The overhead of TCP might decrease the continuity of video
streaming. On the other hand, UDP will just try its best to deliver the packet to the client.
While there might be some lost packets in the middle of video streaming, it can still let you
watch the video without much pause or stutter.

4.2 Present an example of usage of TCP and explain the benefit of it. Why UDP might be a
bad choice in this example?

When you deliver a web page, it contains a lot of information that required to be 100%
correct. Especially when it comes to authentication and verification on the web page. In such
a case, you would like to have an exact page as you expect it to be. By using UDP, you are
likely to lose important pieces of information on the web page since UDP is not as reliable as
TCP.
1. Bridging (21 pts)
1.1 Selective forwarding & forwarding table (10 pts)

1.1.1 Assume the forwarding table at each bridge is empty initially. They are all
learning bridges; the tables will populate automatically as we progress through each
part of this question. Please list the set of bridges that will receive each of the
following frames. (5 pts)

1.1.1.a. Host A sends a frame to Host F


B1, B2, B3, B4

1.1.1.b. Host C sends a frame to Host D


B1, B2, B3, B4

1.1.1.c. Host D sends a frame to Host F


B1, B2, B3, B4

1.1.1.d. Host C sends a frame to Host D


B2, B3

1.1.2 Write out the forwarding table at bridge B2 after the previous 4 frames (5 pts)

Host Port

A 4

C 5

D 7
1.2 Spanning Tree (11 pts)

1.2.1 (6 pts) As described in the lecture, each bridge will send out a configuration
message in the format (RootId, Distance, MyId). After the network has stabilized,

1.2.1.a What configuration will B6 send out?


B6: (B1, 2, B6)

1.2.1.b What configuration will B7 send out?


B7: (B1, 2, B7)

1.2.1.c What configuration will B5 send out?


B5: (B1, 3, B5)

1.2.2 Which ports will be deactivated? (2 pts)

11, 16 and 17

1.2.3 Assume the root bridge suddenly fails, and the network reconverges.

1.2.3.a Who would be the new root? (1.5 pt)

B2, the one with the next-smallest id

1.2..3.b Will any port(s) be deactivated in the new tree? If so, which ones? (1.5 pt)

Port (1,2) 11, 13, 14


2. IP Packet Fragmentation (10 pts)

Our router receives an IP packet. Part of the header of this packet is as follows:

Length ID MF DF OFFSET TTL

600 31 0 0 0 100

Now the router has to fragment this packet and forward the fragments across a
network with an MTU of 260 bytes. (MTU refers to the size of the largest packet that
can be carried in a link-layer frame) Assume the size of the IP header is 20 bytes.

2.1 Number of fragments needed? (2 pts)

2.2 Write out the details of fragments in the same format as provided in 2.1. (6 pts)

Length ID MF DF OFFSET TTL

260 31 1 0 0 99

Length ID MF DF OFFSET TTL

260 31 1 0 30 99

Length ID MF DF OFFSET TTL

120 31 0 0 60 99

2.3 What will get retransmitted if the last fragment is lost? Who will retransmit it?
(2 pts)

The original packet will be retransmitted by the source, and the router will once again need
to fragment it.
3. IPv4 & IPv6 (13 pts)
3.1 Given IPv4 addresses, determine the class of network to which it belongs. (3 pts)
3.1.1 192.168.213.214
class C

3.1.2 124.24.99.14
class A

3.1.3 130.21.24.122
class B

3.2 Given IP address 198.124.1.3, what should the network mask be if I want to subnet
to 8 different subnets? Write out the mask in hexadecimal form. (5 pts)

198.124.1.3 is class C, so the netmask for the network is 11111111.11111111.11111111.0;


the last byte is the host portion. In order to partition the host part into a subnet identifier and
host we need 3 bits.

So the subnet mask would be 11111111.11111111.11111111.11100000


In hexadecimal form: FF.FF.FF.E0, or, in a dotted quad, 255.255.255.224.

3.3 Make F9F9:0011:0000:0000:BBB0:0009:0000:9000 as succinct as possible (2 pts)

F9F9:11::BBB0:9:0:9000

3.4 Determine if the following IPv6 addresses are valid, circle your choice (3 pts)

3378:4581:8::DADA::2131 Vadlid ​Not Valid

39::1 Valid Not Valid

105:0:0:0::01 Valid Not Valid


4. CIDR + Longest Prefix Matching (6 pts)

Given the forwarding table for router R as follows

Destination Next Hop

127.0.0.1 loopback

128.96.39.0/24 Interface 1

128.96.38.0/23 Interface 2

128.17.0.0/16 Interface 3

113.89.79.0/24 Interface 4

<default> 128.17.0.1

What will be the next hop of an incoming packet with the destination as
4.1 128.96.38.7 (2 pts)
Interface 2

4.2 128.17.38.132 (2 pts)


Interface 3

4.3 128.95.39.14 (2 pts)


The router does not know where to forward this packet, it will use the default
entry where next hop is 128.17.0.1, and according to routing table, we will match to
interface 3 as next hop.
5. ARP (10 pts)
Consider the IP network is shown below, where R is a router and S is a switch. A, B,
C, and D are hosts. IP addresses and MAC addresses of hosts and router interfaces
are listed as follows

In this question, we assume R has a complete routing table and S has a complete
forwarding table. However, R’s ARP cache is empty right now.

5.1 R received a packet with the following header


Ethernet Src Ethernet Dst IP Src IP Dst Payload
18:AB:AC:AD:AE:AF 3E:FF:28:29:30:31 192.168.1.3 20.2.3.2 ...

Since R does not have anything in its ARP cache yet, it will not be able to fill in the
Ethernet Dst field before it tries to send it to next hop. Thus, R will send out an ARP
request first. Which host(s) will receive this ARP request sent by R? (2 pts)
C, D

5.2 After the device(s) received the ARP request from R, which will respond? (2 pts)
C

5.3 After the above operation was successfully completed, what would the new header
of the packet that R sending out? (4 pts)
Ethernet Src Ethernet Dst IP Src IP Dst Payload
3E:FF:38:39:40:41 01:FF:12:34:56:78 198.168.1.3 20.2.3.2 ...

5.4 After the above operation was successfully completed, would R send out ARP
requests again for this incoming packet? (2 pts)

Ethernet Src Ethernet Dst IP Src IP Dst Payload


18:AB:AC:AD:AE:AF 3E:FF:28:29:30:31 198.168.1.3 20.2.3.8 ...

Yes, since there is still no cache for 20.2.3.8


6. Domain Name System (10 pts)

Assume we have the following name servers, and the client requests for the IP
address resolution of cse.ucsd.edu (not a domain name in the real world, by the way).

What is the reply that the root name server sends to the local DNS server? What are the
steps that are then followed in the DNS lookup to get the final address of the specified
domain name? Assume that the local DNS server performs a recursive lookup each time on
the remainder of the address and that the IP address for cse.ucsd.edu is 132.239.67.100.

Ans:
1. Distance-vector routing

For the network shown below, provide a global distance-vector table, indicating the
distance from each node to all other nodes for each sub-questions.

a. This is how the table looks initially, when each node only knows the distance to its
immediate neighbors

Node Distance to reach each node

A B C D E F

A 0 Inf 3 8 Inf Inf

B inf 0 inf inf 2 inf

C 3 inf 0 inf 1 6

D 8 inf inf 0 2 inf

E inf 2 1 2 0 inf

F inf inf 6 inf inf 0


b. After the nodes report the information from (a) to its neighbors
Node Distance to reach each node

A B C D E F

A 0 Inf 3 8 4 9

B inf 0 3 4 2 inf

C 3 3 0 3 1 6

D 8 4 3 0 2 inf

E 4 2 1 2 0 7

F 9 inf 6 inf 7 0

c. After the nodes once again report the information from (b) to its neighbors

Node Distance to reach each node

A B C D E F

A 0 6 3 6 4 9

B 6 0 3 4 2 9

C 3 3 0 3 1 6

D 6 4 3 0 2 9

E 4 2 1 2 0 7

F 9 9 6 9 7 0
2. Link-state routing

How the link-state algorithm would build the routing table for node D. To start you off,
the first entry of the table for D has been provided below; use this to get to the next
step, and the next, and so on, to get the final routing table for D.

Routing Table for D


Confirmed Pending

(D, 0, -)

(D, 0, -) (A,8,A), (E,2,E)

(D,0,-) (E,2,E) (A,8,A) (B,4,E) (C,3,E)

(D,0,-) (E,2,E) (C,3,E) (A,6,E) (B,4,E) (F,9,E)

(D,0,-) (E,2,E) (C,3,E) (B,4,E) (A,6,E) (F,9,E)

(D,0,-) (E,2,E) (C,3,E) (B,4,E) (A,6,E) (F,9,E)

(D,0,-) (E,2,E) (C,3,E) (B,4,E) (A,6,E) (F,9,E)


Border Gateway Protocol

Consider the network shown below, wherein horizontal lines represent transit
providers and numbered vertical lines represent inter-provider links. Assume that
networks implement the standard BGP route-selection policy, e.g., preferring shorter
AS paths to longer ones. Please provide you answer in format:

<ISP 1, ISP 2, ISP 3...> across links #, #, ...


a. Suppose that each network adopts a policy that, when choosing among egress
links to the next AS, outbound traffic is carried as far possible within the current AS
(so-called “cold potato routing”). What route and links would packets traverse if:

1. A communicates with B
<P, Q> across link 1

2. E communicates with C
<S, Q> across link 3

3. D communicates with A
<R, Q, P> across links 4 and 1

b. Now, we switch from the “cold potato routing” to “hot potato routing”! It is a
policy wherein outbound traffic is routed to the closest link to the next AS in order to
minimize the intra-AS cost
1. B communicates with D
<Q, R> across link 4

2. A communicates with F
<P, S> across link 2

3. D communicates with A
<R, S, P> across link 5 and 2
Buffering and scheduling
Suppose we have a router with three input ports and three output ports.
- Assume all of the output ports operate at the same speed.
- Assume that the blue-colored packets go out on Output 1, red-colored packets go out
on Output 2, and green-colored packets go out on Output 3.

a. ​Assume that the switching fabric works fast enough such that it is able to take a packet
from each input queue and transfer it to the output in one clock cycle. Also assume the
scheduling time to be trivial.

Assume a simple scheduling algorithm:

Step 1:​ If input queue 1 is not empty, send packet at the head.

Step 2:​ If input queue 2 is not empty, send packet at the head, unless there’s already packet
from other input queue occupied the output queue at the same clock cycle

Step 3:​ If input queue 3 is not empty, send packet at the head, unless there’s already packet
from other input queue occupied the output queue at the same clock cycle

We assume the right most packet in each input queue is the “head” of the queue.
Identify which packet(s) will be transferred at each clock cycle and fill in the table below.

Clock Cycle 1 2 3 4 5 6 7 8 9 10

Input 1 sends Red Blue Red Red Green X X X X X

Input 2 sends Green Red Green Blue Blue X X X X X

Input 3 sends X X X X Red Blue Green Red Green X


(b)Now assume that the input queues make use of a virtual output queue. Also,
assume the same scheduling algorithm as mentioned before, except that each input
queue has a virtual output queue that will be scheduled in the preference order of
blue, red,and green.

(b).1 What problem that is faced in part (a) of the problem does this solve? A one line
answer would do.

This solution solves the head-of-line blocking problem.

(b).2 ​Identify which packet(s) will be transferred at each clock cycle and fill in the table
below.

Clock Cycle 1 2 3 4 5 6 7 8 9 10

Input 1 sends Blue Red Red Red Green X

Input 2 sends Red Blue Blue Green X Green

Input 3 sends Green Green X Blue Red Red


- Traffic Management with Fair Queueing and Weighted Queueing
Consider the network shown below. R1, R2, and R3 are routers and 1, 2, 3, 4 and 5 are
hosts. The id and capacity (bandwidth) of each link (in Mbps) are labeled. Suppose 1,
2, 3 and 4 only send packets to 5 while 5 does not send any packets.

(a) Based on the topology above, what is the maximum throughput (in Mbps) that
can be achieved for the link G in the direction from R3 to host 5?
20

(b) If you are a network engineer and you want to choose a link and increase the
bandwidth to fully utilize the link G, which link would you increase the
bandwidth the first?
Link E, it’s the major bottleneck among R1 and R3 where there are a lot of
hosts at the other end of R1 could get stuck due to the limit between R1 and R3. (As
long as the student solution comes with a reasonable explanation, points would be
awarded.)
(c) Suppose R1 receives the following packets in the order listed at about the
same time. Assume all incoming queues are empty and large enough to keep
all receiving packets. (No dropping) The output port is busy.

Packet Size (in bytes) Flow Weight

1 300 A 1

2 150 B 2

3 120 B 2

4 200 C 4

5 150 C 4

i. Give the order in which these packets leave R1 if fair queueing is applied.
<2, 4, 3, 1, 5>

ii. Give the order in which these packets leave R1 if weighted fair queueing is applied.
<4, 2, 5, 3 ,1>
- Traffic Management with Token Bucket

Assume that we have a token bucket shaper.


1. The token bucket size is 50KB and is full at time=0s.
2. r = 5 KB/s. Only replenish the bucket at the end of each second
3. Packets pass through the token bucket instantaneously if the token they need
is sufficient.
Also assume that a sender emits 10KB-packets every 0.5 seconds, starting at t=0.5s.

(a) How many tokens are left immediately after the third packet was sent? Show
your work for partial credit.

At t = 0, left over = 50 KB.


At t = 0.5, left over = 50KB - 10KB = 40KB
At t = 1, left over = 40KB - 10KB + 5KB = 35KB
At t = 1.5, left over = 35KB -10KB = 25KB
At t = 2, left over = 25KB -10KB + 5KB = 20KB

(b) If we indexing the packets starting from 0, which packet would be the first to
get queued due to the scarcity of token?
At t = 0, left over = 50 KB.
At t = 0.5, left over = 50KB - 10KB = 40KB id=0
At t = 1, left over = 40KB - 10KB + 5KB = 35KB id=1
At t = 1.5, left over = 35KB -10KB = 25KB id=2
At t = 2, left over = 25KB -10KB + 5KB = 20KB id=3
At t = 2.5, left over = 20KB -10KB = 10KB id =4
At t = 3, left over = 10KB -10KB+5KB = 5KB id =5, still got sent
At t = 3.5, packet with id as 6 would not have enough token to get sent.

Thus, the answer is a packet that has id as 6.

(c) Now, we turn the infinite maximum rate R to 15 KBps, and we refill the bucket
continually with r = 5 KB/s, (instead of refill at the end of each second), what
would the maximum burst size be?

We use the formula: b * R/(R − r) = (50KB * 15KBps)/(15KBps − 5KBps) = 75KB .


- TCP Congestion Control

(a) Fill in the blanks in this table according to the diagram above:

A B C D E F G H I

Time (in the unit of RTT) 0 3 5 6 14 15 29 33 37

CWND 1 8 32 16 24 12 26 1 16

(b) Based on the diagram and table, make some Inferences.


1. How would you describe the stage between A and C?

TCP Slow Start


2. How would you describe the stage between D and E?

AIMD/Congestion Avoidance
3. How would you describe the stage between F and G?

AIMD/Congestion Avoidance
4. How would you describe the stage between H and I?

Slow Start
5. What would ssthresh be after the timeout at H?

13
Name:____________________________ Student ID:____________________________

CSE123 Spring 2015 Homework #2


Instructor: Stefan Savage

Due Wednesday 4/29 at the beginning of class


(Please TYPE your answers… this will allow our TAs to be much more efficient)

1. IP Checksum

Below is a diagram of the IPv4 packet header format. The header is protected
using a separate checkum (the “Header Checksum” field below) using the IP
Checksum algorithm we described in class.

Consider a packet with the following content (in hex):

4500 0028 3e8a 4000 8006 9bd2 c0a8 0265 c73b 9b2a

a) What is the value of checksum carried in this packet?

9bd2

b) Is it correct? (show your work to calculate the IP checksum for this data; note
that the checksum field itself is set to zero when calculating the checksum)

As in class

c) The “Time to Live” field in this packet is set to 128. However, each time the
packet is forward by a router this field will be decremented by one (i.e., it will
next be set to 127). How will the checksum need to change in response?

d) Is it possible to update the checksum in this case (as per part [d]) without
recomputing the checksum over the entire packet header? If not, why not? If
so, how?
Name:____________________________ Student ID:____________________________

Since the checksum is computed on 16-bit fields, if a single such field changes from its
old value (of) to its new value (nf), the old checksum (OC) can be transformed into the
new checksum (NC) incrementally in 1s complement arithmetic as follows:
NC = OC + (of – nf)
[Technically it should be NC = ~(~OC + ~of + nf) to deal with the fact that one’s
compliment is not distributive when the result is 0, but this is not necessary for a correct
answer]

2. Reliable Transmission

Consider a system that uses ARQ as described in class, using timeouts to


detect loss. Assume the sender has an infinite number of packets to send, but
every third packet that is transmitted by the sender is lost en route (assume all
ACKs are delivered correctly). The length of the timeout is t and the round-
trip time is m (m << 4*t... i.e.). Consider how the long it will take to
successfully send the first eight packets. For each of the following cases,
i) provide a comma separated list showing the order of packets sent
by the sender, by sequence number (include packets lost in transit
and any retransmissions) and
ii) describe how much time it will take to deliver all 8 packets (in
terms of t and m)

a) Using the alternating bit protocol (i.e., a send window of 1).

i) 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8
ii) 3 * (2m + t) + 2m
You’ll get two packets each RTT, but the third will be lost and you’ll
wait a timeout. You’ll need to repeat this three times to get 6 packets
and the last two packets will each take one RTT to transmit (2m all
told)

b) Describe how much time it will take with a send window of 4 packets, but
using the GoBackN retransmission strategy (i.e., a receive window of 1).
Assume that serialization delay is 0 (i.e., you can send multiple back-to-
back packets with no additional delay)

i) 1, 2, 3, 4, 5, 6, 3, 4, 5, 6, 7, 8, 5, 6, 7, 8, 9, 10, 7, 8
ii) 3t + m

You’ll send 4 packets at once, and packets 1, 2 and 4 will get through,
but packet 3 will be lost. The acks for packets 1 and 2 will allow
packets 5 and 6 to be sent. Packet 6 will also be lost (since it is also a
third packet sent), but this is irrelevant since packet 3 will timeout at
time t and we’ll retransmit packets 3, 4, 5 and 6. So we successfully
Name:____________________________ Student ID:____________________________

sent two packets in time t and we’re now starting from a first packet
again (restarting the cycle). So its going to take 3t (3 times through
this cycle to send 6 packets) + m (the last two packets will get sent and
then acknowledged in one RTT)

c) Describe how much time it will take with a send window of 4 packets, a
receive window or 4 and the selective retransmission strategy described in
class (retransmit the first missing packet).

i) 1, 2, 3, 4, 5, 6, 3, 6, 7, 8, 9, 10, 7
ii) 2t+2m

You’ll send 4 packets at once, and packets 1, 2 and 4 will get through,
but packet 3 will be lost. The ACKs for packets 1 and 2 will allow
packets 5 and 6 to be sent. Packet 6 will also be lost (since it is also a
third packet sent). At time t, a timeout happens and the sender
retransmits packet 3. After one round-trip time (at time t+m), the
sender receives an ACK for packet 5 and will now transmit packets 6,
7, 8 and 9 (since it has a window size of 4). Of these, packet 7 is lost
since it is a third packet. However, we do receive an ACK for packet
six and thus are allowed to send one additional packet: packet 10. It
will be lost, since it is a third packet, but we don’t care about it. At
time 2t+m, the sender will time on packet 7 and retransmit it. One
round-trip time later, at time 2t+2m, it will receive an ACK for packet
9 and we will know that all 8 packets have been successfully delivered.
Name:____________________________ Student ID:____________________________

3. Media access
Consider a slotted Aloha system with four nodes in which the probability that
each node has data to send in a given slot time is p.

a) What is the likelihood that none of the nodes send any data in a given slot
time?
(1-p)^4

b) What is the likelihood that any node successfully sends data in a given slot
time?
4p(1-p)^3

This is from class. For each node there is the probability that it sends
(p) while the other three nodes don’t (1-p)^3. These are independent
probabilities so for four nodes, 4p(1-p)^3 represents the likelihood of
any one being successful.

c) What is the likelihood that there is a collision in a given slot time?


This one is a bit tricky. To do this constructively, you would need to
consider the 9 combinations that have collisions vs the ones that do
not. However, you can more easily do it by noticing that the solution
to a and b define all the options where there is no collision. Thus, you
can determine the answer is:
1 - (1-p)^4 - 4p(1-p)^3

d) Suppose the length of the slot time is doubled. Assume that each node
always has data to send and modulation is unchanged (i.e., the same
number of bits per second can be sent). Do you expect total “goodput”
(successful transmission of data over time, measured in bits per second) to
go up, down or stay the same? Explain?

The amount of data transmitted in a slot will go up by two since the


slots are longer. However, the amount of time wasted will also go up
by two. The proportion between the two (the ratio between b and
a+c) is unchanged so the total goodput will be unchanged.
Name:____________________________ Student ID:____________________________

4. Bridging
Consider the network connected by learning bridges B1 and B2 shown below.
Each LAN is connected to the bridge with a listed port number and each host
is indicated with a letter.

A D
1 2
B1

B
1 2
B2
3

E
C

F
Assuming that the initial forwarding tables are empty, show the forwarding
table in each of the bridges after the following sequence of transmissions:

a) A sends to C

Bridge B1 Bridge B2
Destination Port number Destination Porter number
A 1 A 2

b) D sends to A

Bridge B1 Bridge B2
Destination Port number Destination Porter number
A 1 A 2
D 2 D 2

c) E sends to F

Bridge B1 Bridge B2
Destination Port number Destination Porter number
A 1 A 2
D 2 D 2
E 1 E 1
Name:____________________________ Student ID:____________________________
CSE123 Spring 2015 Homework #3
Instructor: Stefan Savage

Due Friday 5/27 at the beginning of class


(Please TYPE your answers… this will allow our TAs to be much more efficient)

1. IP addressing

Consider the IPv4 address 128.2.145.6

a) Assuming we’re using class-based addressing, explain i) what “class” the


address is and ii) what is the address of the network part and iii) what is
the address of the host part

i) this is a class B address


ii) the network part is 128.2.x.x (saying 128.2 or 128.2/16 is fine too)
iii) the host part is 145.6 (or any reasonable description thereof

b) Assume that we’re using classless (i.e., CIDR) addressing and the longest
matching advertised route cover this address is 128.2.128.0/17. As with
part “a” above explain i) what is the network part of the address and ii)
what is the host part

i) 128.2.128.0/17 (i.e. the first 17 bits of the address)


ii) 0 (the last 15 bits of the address)

c) Inside the organization that owns this network (CMU incidentally) they
further subdivide the host part of the address (from part b above) into a
subnet prefix and host address (let suppose the least significant 8 bits
represent the host and the remainder identifies the subnet inside CMU).
How many different LANs can be supported with this subnetting
architecture?

If there are 15 bits in the host part and 8 are used for hosts within a
subnet, then there are 7 bits for subnetting, or 128 distinct subnets
(I’m also ok with the answer 127 if they want to argue that the all 0
subnet won’t be allowed)
Name: _________________________________

2. 4. Routing
DV Routing(15pts)
a) Consider
Consider this distance
the following network vector network:
using distance vector routing:

 
SupposeSuppose
an additional link is added
an additional linkconnecting A and C with
is added connecting costC2.with
A and List the
costdistance vector
2. List the
updates that will be sent for the system to reconverge (the first update, from A, is listed
distance vector updates that will be sent for the system to reconverge (the first
below). Assume that updates occur simultaneously in rounds (i.e., at a set time each node
update, from A, is listed below). Assume that updates occur simultaneously in
transmits their distance vectors to their neighbors). You only need list DV updates in a route
rounds.
that have changed since the last round. [also: ignore split horizon or poison reverse in this
example]
Round 1:
Round 1: A: 0, 3, 2, 3, 1
C:3,2,1 1,(reflecting
A: 0, 6, 2, 0, 2, 3 only the change in the AC link)
Round 2:
C: 2, 1, 0, 2, 4 (reflecting only the change in the AC link)
Round 2: B: 3, 0, 1, 3, 4
E:3,1,14,(A’s
A: 0, 3, 2, 3, 2,cost
0 [done] 
to B is updated by C’s vector from round 1)
B: 3, 0,
  1, 3, 5 (B’s cost to A is updated by C’s vector from round 1)
C: 2, 1, 0, 2, 3 (C’s cost to E is updated by A’s vector from round 1)
Round
b) 3:
It what way does distance-vector routing scale better than link-state routing? Be specific.
B: 3, 0, 1, 3, 4 (B’s cost to E is updated by A’s vector from round 2)
E: 1, 4, 3, 2, 0 in
Routers (E’s cost tovector
distance B andprotocols
C is updated
only by A’s vector
receive updatesfrom
fromround
their 2)
immediate
[done]neighbors, while routers must manage LSPs from every router in the network in
link-state protocols.

3. DHCP/ARP
c) Give
Suppose a hosttwo reasons why
A (Ethernet intra-domain
address: routing protocols
3c:15:c2:cd:46:4c ) , startsare
up not
and suitable
wants tofor inter-
send a
domain routing?
packet to some remote Internet host with IP address 128.95.1.2. On the same LAN as host
A is a DHCP server (IP address: 132.239.1.2, Ethernet address: 00:c0:ff:72:dc:2c)
and the [acceptable answers
default router for theinclude:
LAN (IPdon’t want132.239.1.1,
address: to expose internal
Ethernetstate about
address:
network, can’t scale to number of routers in Internet, Internet routing not
00:c0:ff:65:23:49). Assume that the DHCP server will allocate 132.239.1.3 to the
focused on path optimization, need administrative isolation, etc]
next host asking for an IP address and that all ARP caches are empty. Describe the
sequence of DHCP and ARP requests/responses among these parties from when host
A starts to the point where they are able to send a packet to 128.95.1.2. Label each
request/response with the appropriate source and destination Ethernet and IP
addresses.
DHCP Discover
MAC Source: 3c:15:c2:cd:46:4c
MAC Destination: ff:ff:ff:ff:ff:ff
IP Source: 0.0.0.0
IP Destination: 255.255.255.255

DHCP Offer
MAC Source: 00:c0:ff:72:dc:2c
MAC Destination: ff:ff:ff:ff:ff:ff
IP Source: 132.239.1.2
IP Destination: 255.255.255.255

DHCP Request
MAC Source: 3c:15:c2:cd:46:4c
MAC Destination: ff:ff:ff:ff:ff:ff
IP Source: 0.0.0.0
IP Destination: 255.255.255.255

DHCP Ack
MAC Source: 00:c0:ff:72:dc:2c
MAC Destination: 3c:15:c2:cd:46:4c
IP Source: 132.239.1.2
IP Destination: 132.239.1.3

ARP Request
MAC Source: 00:cO:ff:72:dc:2c
MAC Destination: ff:ff:ff:ff:ff:ff
IP Source: 132.239.1.3
IP Destination: 132.239.1.1

ARP Reply
MAC Source: 00:c0:ff:65:23:49
MAC Destination: 00:c0:ff:72:dc:2c
IP Source: 132.239.1.1
IP Destination: 132.239.1.3
4. Link-state routing
A link-state routing protocol provides each node with a complete map of the topology. In
typical usage each node then runs Dijkstra’s algorithm to compute the shortest path from that
node to every other node. The appropriate next hop for each destination is extracted from this
result and installed into the router’s packet forwarding table. However, this approach restricts
packets bound for a given destination to use a single path and therefore the network may not
be optimally utilized. For example, in the network below, A will always send to C through B,
since that is the lowest cost path – even though the direct path (cost 6) could be used as well.

2 1

C 6 A

2 3

To help address this, most routers support a feature – equal cost multipath – that allows a
router to split traffic between multiple next hop routers, so long as they are on paths of equal
cost. For example, using this feature, router D could forward half of its traffic bound for B
through A and the other half through C (both paths have cost 4). This works. Indeed, if the
traffic is split in this way, D can be guaranteed that A and C will deliver it successfully to B.

However, this is not true in general for non-equal cost paths.

a) Give an example in this network where a router forwarding traffic between two non-
equal costs paths will lead to a problem.

Consider what happens if B tries to split its load to C. Half of its traffic goes
directly to C and the other half to A. For the traffic arriving at A, the shortest path
to C is back through B. Consequently, this will create a routing loop for this traffic
between A and B for traffic destined to C.

b) Explain why this works in general for equal cost paths, but not for non-equal cost paths?

Link-state protocols create an environment in which each router has complete


knowledge of the entire topology. Since each router calculates the shortest path
from itself to each destination, when it forwards a packet to the next hop on the
shortest path it can assume that the next hop router’s version of the shortest path is
a “suffix” of its own shortest path and thus each “hop” will strictly decrease the cost
to get to the destination. When we send traffic along multiple equal-cost paths, this
property is still true and at each and every “hop” the shortest path to the
destination decreases. Since the cost always decreases on each hop, there can be no
loops. However, with non-equal cost paths a packet that takes the a non-shortest-
path can actually cause the distance to the destination to increase (as seen in the
example above)
CSE123 Spring 2015 Homework #4
Instructor: Stefan Savage

Due Friday 6/5 at the beginning of class


(Please TYPE your answers… this will allow our TAs to be much more efficient)

1. TCP performance

a) Consider a TCP-based application in which a sender tries to transfer


100MB to a receiver. The bottleneck link between the sender and receiver
is 10Mbps and there is no competing traffic. The round-trip time is 10ms
and the packet size is 1KB. The receiving application reads 100KB of
data every second and has 1MB of buffer. Will this application by limited
by congestion control or flow control? (explain your answer)

This application is limited by flow control. The application is only reading at 100KB per
second. The 1MB buffer will fill fairly quickly after which the steady state draw of the
application will be 100KB/sec (i.e., 800Kbps). For a router with minimal buffering
congestion control will not cause backoffs until the congestion window is over 1250 packets,
and even if cwnd were reduce in half at that point (625 packets) this is considerably more
than 100KB/sec.

b) Consider two TCP flows: one between hosts A and B with a RTT of 10ms
and a bottleneck of 10Mbps and the other between hosts C and D with a
RTT of 100ms and a bottleneck of 100Mbps. Suppose you need to
transfer a 1MB file between each pair of hosts (from A to B and from C to
D). How fast will each transfer take and which will complete first (or will
they complete at the same time?)

The flow between A& B will complete first. Using TCP congestion control, the 1MB file will
be covered by k windows (the first window will hold 1 packet and will double every RTT due
to slow start). The bottleneck capacity of the link, even at 10Mbps, is higher than the total
size so we will never lose a packet. So how big is k? If we have 1500 byte packets, its
log2(1MB/1.5KB) which is ~9.3 (round up to 10) RTTs or 100ms. With a 100ms RTT the
flow between C&D will take 10 times longer (1second approximately).

c) In class we’ve explained that the TCP receiver sends an ACK in response
to each packet it receives. However, this is not true in practice. For
historical reasons, TCP implements a “delayed ACK” policy at the
receiver, in which acknowledgements may be delayed up to 500ms in the
hope that another packet will be received and a single ACK can be sent for
both (TCP guarantees that the second in-sequence packet will always
generate an ACK). For a large transfer (e.g., 100MB) does this
optimization make TCP send more quickly, less quickly or the same?
(explain your answer)

Delayed ACKs will make TCP send more slowly because the ACKs implicitly control the
window size at the sender. Send ACKs less frequently will cause the congestion window to
open more slowly and thus it will take longer for TCP to reach its maximum throughput.
2. Quality of service

a) The following graph shows the rate at which data enters a router
implementing a token bucket-based traffic policing policy with r=15kbps.
What is the minimum size (in bits) for the token bucket depth, b, to ensure that
none of this traffic will be dropped?

Min  B  =  ((40-­‐15)  *20)  +  ((50-­‐15)*10)  –  ((15-­‐10)  *  20)  +  ((20-­‐15)*40)  =  950bits  

b) In the diagram below, routers R1 and R2 implement fair queuing. FlowA


transmits at a rate of 5 Kbps at router R1. FlowB transmits at a rate of 2 Kbps
at R1. Both are competing for the same outgoing link at R1 and that link has 6
Kbps of available bandwidth (represented by BW1-2 in the figure). FlowC
transmits at a rate of 4 Kbps at R2, where FlowA is competing with FlowB and
FlowC. How much bandwidth will each flow be allocated when exiting R2?

R1  output  link:    FlowA=4Kbps,  FlowB=2Kbps  


R2  output  link:  Flow  A=  3.5Kbps,  Flow  C  =  3.5Kbps,  FlowB  =  2Kbps
 
CSE 123: Computer Networks 
Homework 1 Solutions 
Out: 4/6, Due: 4/13 
Total Points = 25 
 
1. MESSENGER Spacecraft [4 pts] 
NASA launched a space probe, called MESSENGER, designed to study the 
planets Mercury and Venus. Assume MESSENGER uses an X​ Band (i.e., RF) 
communication system to achieve a 250 kbps point­​ to­​
point link between it and 
the Earth station. The distance between Earth and Mars is approximately 75 
million km. 
a. Calculate the minimum RTT and the bandwidth­delay product for the link 
i. RTT = 2*dist/signal propagation speed = 2*(75*10^9 m) / (3*10^8 
m/s) = 500 seconds 
ii. Bandwidth­delay product = 250*10^3 * 500 = 125*10^6 bits 
Will also accept => Bandwidth x RTT/2 = 62.5*10^6 bits 
b. Let us assume that the space probe sends 10MB of data back to earth 
periodically. What would be the total time for the Earth station to get the 
entire 10MB of data? (ie. the time taken for a single 10MB data transfer) 
i. Total time = transmit time + propagation time = (8*10*1024*1024) / 
(25*10^4) + 500 / 2 = 585.54432 seconds 
Assume the speed of light through outer space is 3x10^8 m/s 
 
 
2 pts for part a 
● 1 pt for the right formula/setting it up 
● 1 pt for the correct answer 
○ 0.5 pts if almost correct, but off due to an arithmetic error 
2 pts for part b 
● 1 pt for the right formula/setting it up 
○ 0.5 pts if using 2­way propagation time without stated assumption that 
receiver will send acknowledgements 
● 1 pt for the correct answer (or correct follow through if 0.5 pts from above) 
○ 0.5 pts if almost correct, but off due to an arithmetic error or because units 
are wrong for file size and data rate 
CSE 123: Computer Networks 
Homework 2 Solutions 
Out: 4/20, Due: 4/27 
 
Total Points = 28 
 
Problems 
1. High Frequency Trading [5 pts] 
Companies like Goldman Sachs put a high value on using very low latency 
network switches to engage in high frequency trading because even an extra 
delay of a few milliseconds in their switches can lose them tons of money. 
Calculate the latency (from first bit sent to last bit received) for the following: 
a. 30­Mbps Ethernet with a single store­and­forward switch in the path and a 
packet size of 6,000 bits. Assume that each link introduces a propagation 
delay of 50 µs and that the switch begins retransmitting immediately after 
it has finished receiving the packet. 
i. Total time = (transmit time + propagation time) * number of links to 
destination = ( (6*10^3 / 30*10^6) + 50us) * 2) = 250us * 2 = 500us 
b. Same as (a) but with three switches. 
i. Total time = time per link from (a) * number of links to destination = 
250us * 4 = 1ms 
c. Same as (a), but assume the switch implements “cut­through” switching; it 
is able to begin retransmitting the packet after the first 300 bits have been 
received. What is the time savings of using “cut­through” switching? 
i. This effectively replaces the switch transmit delays to the delay to 
transmit those 300 bits for each switch. So Total time = switch 
queue time * number of switches + original transmit time + 
propagation time * number of links to destination = (300 / 
30*10^6)*1 + (6*10^3 / 30*10^6) + (50us * 2) = 10us + 200us + 
100us = 310us 
ii. 500us ­ 310us = 190us is the time savings 
 
2 pts for a 
● 1 pt for correct setup/formula 
● 1 pt for correct answer 
1 pt for b for correct answer 
2 pts for c 
● 0.5 pts for good setup with cut through switch 
● 1 pt for correct time with a cut through switch 
● 0.5 pts for correct time savings 
 
 
2. Sliding Window Protocol [5 pts] 
Draw a timeline diagram for the sliding window algorithm with SWS = RWS = 3 
frames, for the following two situations. Use a timeout interval of about 2 × RTT. 
Assume fast retransmission with selective retransmission is implemented and 
that packets with sequence numbers 1­6 will be sent. For fast retransmission, if 
more than 1 duplicate ACK is received, only retransmit on the first duplicate ACK. 
(a) Frame 4 is lost on the first transmission. 

 
 
 
 
 
 
(b) Frames 3 and 6 are lost on their first transmissions. 

 
 
2 pts for a 
● 0.5 pts for showing dropped packet 
● 0.5 pts for retransmitting at the first duplicate ACK 
● 1 pt for the rest being correct 
3 pts for b 
● 1 pts for dropped packets 
○ 0.5 pts for 3 
○ 0.5 pts for 6 
● 1 pt for retransmissions 
○ 0.5 pts for retransmitting 3 at first duplicate ACK 
○ 0.5 pts for 6 being transmitted after timeout 
● 1 pt for the rest being correct 
 
 
** Note: The timeout being 2 RTT did leave some room for ambiguity on this problem 
because the packet with sequence number 5 on part a for example will be timing out 
right when it receives the cumulative ACK for 6. As such, credit will be given to those 
who decide to retransmit at that timeout. 
 
 
3. Sharing the Ethernet [4 pts] 
Suppose A, B, and C all make their first carrier sense, as part of an attempt to 
transmit, while a fourth station D is transmitting. Draw a timeline showing one 
possible sequence of transmissions, attempts, collisions, and exponential backoff 
choices. A simpler example of the problem is given to you below. Your timeline 
should also meet the following criteria: 
(i) initial transmission attempts should be in the order C, A, B 
(ii) successful transmissions should be in the order A, B, C 
(iii) there should be at least four collisions. 
 
 
 
To the left, A and B make their 
first carrier sense while C is 
transmitting. The initial 
transmission attempts are in the 
order A,B.  Successful 
transmissions in the order B,A. 
There are 2 total collisions that 
occur. The light blue boxes with 
a letter in them means that the 
transmitter with that letter is 
successfully transmitting on the 
channel. The red boxes indicate 
that a collision has occurred. 
 
 
 
1 pt for initial transmissions in right order 
2 pt for at least 4 collisions 
1 pt for successful transmissions in right order 
­0.5 pts for each type of minor error 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4. Ip Checksum and Endianness [5 pts] 
a. The following IPv4 header, show in hex below, is received for an IP packet 
at its destination. Refer to the IPv4 header diagram below. 
 
4500 05c8 1c46 25c8 4017 c311 aca8 0101 aca8 0102 
 

 
Ipv4 Header 
 
b. What is the header checksum? (You can find it by mapping the hex values 
to the IPv4 header diagram) 
i. c311 
c. Using the Internet checksum algorithm, determine if there were any errors 
in the transmission (show work). 
i. Answer below 
 
0100 0101 0000 0000 (4500) 
0000 0101 1100 1000 (05c8) 
­­­­­­­­­­­­­­­­­­­ 
0100 1010 1100 1000 (4ac8) 
0001 1100 0100 0110 (1c46) 
­­­­­­­­­­­­­­­­­­­ 
0110 0111 0000 1110 (670e) 
0010 0101 1100 1000 (25c8) 
­­­­­­­­­­­­­­­­­­­ 
1000 1100 1101 0110 (8cd6) 
0100 0000 0001 0111 (4017) 
­­­­­­­­­­­­­­­­­­­ 
1100 1100 1110 1101 (cced) 
0000 0000 0000 0000 (0000) 
­­­­­­­­­­­­­­­­­­­ 
1100 1100 1110 1101 (cced) 
1010 1100 1010 1000 (aca8) 
­­­­­­­­­­­­­­­­­­­ 
1 0111 1001 1001 0101 (17995) 
 
0111 1001 1001 0110 (7996) 
0000 0001 0000 0001 (0101) 
­­­­­­­­­­­­­­­­­­­ 
0111 1010 1001 0111 (7a97) 
1010 1100 1010 1000 (aca8) 
­­­­­­­­­­­­­­­­­­­ 
1 0010 0111 0011 1111 (1273f) 
 
0010 0111 0100 0000 (2740) 
0000 0001 0000 0010 (0102) 
­­­­­­­­­­­­­­­­­­­ 
0010 1000 0100 0010(2842) 
 
Do the complement 
1101 0111 1011 1101 (d7bd) 
 
There were errors because the computed checksum transmitted was 
c311, but it should have been d7bd. Alternatively, do sum the header with 
the provided checksum and compare to 0xFFFF. 
 
 
 
 
 
 
 
 
 
 
 
 
d. What would this packet which is network byte order look like when stored 
in the memory of a big­​ endian system? (Assume that the packet is stored 
in an array of (32​
bit) integers in memory.) 
i.  
#  Data 

0  45 00 05 c8 

4  1c 46 25 c8 

8  40 17 c3 11 

12  ac a8 01 01 

16  ac a8 01 02 
 
e. How about in the memory of a little​ ­endian system? (Again assume that 
the packet is stored in an array of integers in memory) 
i.  
#  Data 

0  c8 05 00 45 

4  c8 25 46 1c 

8  11 c3 17 40 

12  01 01 a8 ac 

16  02 01 a8 ac 
 
 
1 pt for b for correctness 
2 pts for c 
● 0.5 pts for stating there were errors 
● 1.5 pts for computing the checksum 
○ 1 pt for showing sensible work 
○ 0.5 pts for the correct checksum 
1 pt for d for correctness 
● 0.5 pts for minor error 
1 pt for e for correctness 
● 0.5 pts for minor error 
5. Spanning Tree Question [3 pts] 
Given the extended LAN shown below, indicate which ports are not selected by 
the spanning tree algorithm. 
 

 
 
 
 
3 pts for spanning tree 
● 1 pt for B7 cuts (split between both) 
● 1 pt for B6 cuts (split between both) 
● 1 pt for B3 cut 
● ­0.5 pts for each bad cut on any other bridges or between B3 and J 
 
 
 
 
 
 
 
 
 
6. Learning Bridges [6 pts] 
 
Use the diagram below to answer the following questions. Assume the circles are 
bridges and the rectangles are LANs with only one host defined by their letter. All 
bridges have empty tables at the beginning and the events below occur in the 
order presented. 
 

 
 
 
a. E sends a packet to F, who receives the packet? 
i. C,D,F,G 
b. C sends a packet to E, who receives the packet? 
i. E 
c. D sends a packet to C, who receives the packet? 
i. C 
d. E sends another packet to F, who receives the packet? 
i. C,D,F,G 
e. G sends a packet to C, who receives the packet? 
i. C,F 
f. F sends a packet to D, who receives the packet? 
i. D,E,G 
 
 
6 pts 
● 1 pt for each a­f for correctness (total of 6) 
CSE 123: Computer Networks 
Homework 3 Solutions 
Out: 5/11, Due: 5/18 
Total Points = 27 
 
Problems 
1. Distance­Vector Routing [9 points] 
For the network shown below, give the global distance­vector tables like those in 
Tables 3.10 and 3.13 on pages 244 and 246 in the book (P&D) when 
a. Each node knows only the distances to its immediate neighbors. 
 
  A  B  C  D  E  F 

A  0  Inf  2  3  Inf  Inf 

B  Inf  0  Inf  Inf  1  Inf 

C  2  Inf  0  Inf  8  6 

D  3  Inf  Inf  0  2  Inf 

E  Inf  1  8  2  0  Inf 

F  Inf  Inf  6  Inf  Inf  0 


 
b. Each node has reported the information it had in the previous step to its 
immediate neighbors. 
 
  A  B  C  D  E  F 

A  0  Inf  2  3  5  8 

B  Inf  0  9  3  1  Inf 

C  2  9  0  5  8  6 

D  3  3  5  0  2  Inf 

E  5  1  8  2  0  14 

F  8  Inf  6  Inf  14  0 


 
c. Step “b.” happens a second time. 
 
  A  B  C  D  E  F 

A  0  6  2  3  5  8 

B  6  0  9  3  1  15 

C  2  9  0  5  7  6 

D  3  3  5  0  2  11 

E  5  1  7  2  0  14 

F  8  15  6  11  14  0 


 
 

 
 
3 pts for each of a, b, and c (9 pts total) 
● ­0.5 pts for each incorrect row in the tables 
Blank table entries will be treated as Infinity 
 
 
 
 
 
 
2. Link­State Routing [6 points] 
Using the same network topology as in the figure in problem 4, draw the table 
like Table 3.14 on page 258 in the book (P&D) that shows the steps for building 
the routing table of node C. 
 
 
Confirmed  Tentative  Comments 

(C,0,­)    Initial node 

(C,0,­)  (A,2,A) (E,8,E) (F,6,F)  C Neighbors 

(C,0,­) (A,2,A)  (E,8,E) (F,6,F)  Added A 

(C,0,­) (A,2,A)  (E,8,E) (F,6,F) (D,5,A)  A Neighbors 

(C,0,­) (A,2,A) (D,5,A)  (E,8,E) (F,6,F)  Added D 

(C,0,­) (A,2,A) (D,5,A)  (E,7,A) (F,6,F)  D Neighbors; cheaper path 


found for E 

(C,0,­) (A,2,A) (D,5,A)  (E,7,A)  Added F 


(F,6,F) 

(C,0,­) (A,2,A) (D,5,A)  (E,7,A)  F has no new Neighbors 


(F,6,F) 

(C,0,­) (A,2,A) (D,5,A)    Added E 
(F,6,F) (E,7,A) 

(C,0,­) (A,2,A) (D,5,A)  (B,8,A)  E Neighbors 


(F,6,F) (E,7,A) 

(C,0,­) (A,2,A) (D,5,A)    Added B; done 
(F,6,F) (E,7,A) (B,8,A) 
 
6 pts total 
● 0.5 pts for each of the initial and added nodes steps (3 pts total) 
● 0.5 pts for each updating tentative nodes steps (2.5 pts total) 
● 0.5 pts for having all correct confirmed entries 
 
 
 
 
3. AS Routers [7 points] 
Suppose P, Q, and R are network service providers with respective CIDR 
address allocations 211.0.0.0/8, 212.0.0.0/8, and 213.0.0.0/8. Each provider’s 
customers initially receive address allocations that are a subset of the provider’s. 
P has the following customers​ : 
PA, with allocation 211.163.0.0/16 
PB, with allocation 211.176.0.0/12. 
Q has the following customers​ : 
QA, with allocation 212.10.16.0/20 
QB, with allocation 212.11.0.0/16. 
 
*Note: For each routing table below you only need two columns; one for the 
CIDR prefix to match and the other being the next hop (ex. R, PA, QB, etc.). 
 
a. Give routing tables for P, Q, and R assuming each provider connects to 
both of the others. 
 
P’s Table 
address  nexthop 

212.0.0.0/8  Q 

213.0.0.0/8  R 

211.163.0.0/16  PA 

211.176.0.0/12  PB 
 
 
Q’s Table 
address  nexthop 

211.0.0.0/8  P 

213.0.0.0/8  R 

212.10.16.0/20  QA 

212.11.0.0/16  QB 
 
 
R’s Table 
address  nexthop 

211.0.0.0/8  P 

212.0.0.0/8  Q 
 
b. Now assume P is connected to Q and Q is connected to R, but P and R 
are not directly connected. Give tables for P and R. 
Only 2 changes, one in each table: 
P’s Table 
address  nexthop 

212.0.0.0/8  Q 

213.0.0.0/8  Q 

211.163.0.0/16  PA 

211.176.0.0/12  PB 
 
R’s Table 
address  nexthop 

211.0.0.0/8  Q 

212.0.0.0/8  Q 
 
 
c. Suppose R is removed. Then customer PA acquires a direct link to Q, and 
QA acquires a direct link to P, in addition to the other existing links. Give 
tables for P and Q (should no longer include R). 
P’s Table 
address  nexthop 

212.0.0.0/8  Q 

212.10.16.0/20  QA 

211.163.0.0/16  PA 

211.176.0.0/12  PB 
 
Q’s Table 
address  nexthop 

211.0.0.0/8  P 

211.163.0.0/16  PA 

212.10.16.0/20  QA 

212.11.0.0/16  QB 
 
3 pts for part a 
● 1 pt for having a table for each of P, Q, and R (3 pts total) 
● ­0.5 pts for each incorrect or unnecessary entry up to ­1 pt per table 
2 pts for part b 
● Same general break down as part a 
2 pts for part c 
● Same general break down as part a 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4. BGP Routing [5 points] 
Consider the network shown below, in which horizontal lines represent transit 
providers and numbered vertical lines are inter­provider links. A, B, and C are 
networks connected to a particular provider below. The numbered links 2, 3, and 
4 just show the links between the providers. For the purposes of this problem, a 
route can be written as a comma separated path from one provider to another. 
Ie. the route from B to A through R would be A:<Q,R, P>.  

 
 
a. Suppose that P, Q, and R are all peer autonomous systems. List the paths 
that provider P knows to get to network C. If there are none, say so. 
Only <P, R> because Q isn’t advertising a path/ route to R through itself 
 
b. Similarly, list the paths that provider R has to get to network B. If there are 
none, say so.  
Only <R, Q> because P isn’t advertising a path/ route to Q through itself 
 
c. Now suppose providers P, Q, and R adopt the policy that outbound traffic 
is routed to the “closest” inter­provider link that it knows has a path to the 
destination, thus minimizing their own cost (e.g., P is “closer” to network C 
than Q as far as R is concerned because link 4 is closer to C than link 3). 
If P and Q are customers of R, and P and Q are peers, what routes will 
traffic from network A to network C follow? What about traffic from network 
C to network B?  A to B? 
A­>C : <P, R> 
C­>B : <R, Q> 
A­>B : <P, Q> 
 
 
d. Suppose the same as part c above except that now P and R are 
customers of Q, and P and R are peers. What paths will traffic from 
network A to network C take? What about from network C to network B? C 
to A? 
 
A­>C : <P, Q, R> 
C­>B : <R, Q> 
C­>A : <R, P> 
 
 
1 pt for part a for correctness 
1 pt for part b for correctness 
1.5 pts for part c 
● 0.5 pts for each correct path (1.5 pts total) 
1.5 pts for part d 
● 0.5 pts for each correct path (1.5 pts total) 
 
CSE 123: Computer Networks 
Homework 4 Solutions 
Out: 5/25, Due: 6/1 
 
Problems 
1. Scheduling and QoS 
 
Packet #  Size  Flow 

1  70  1 

2  210  1 

3  100  1 

4  260  2 

5  20  2 

6  240  3 

7  90  3 

8  180  3 
 
Suppose a router has three input flows and one output. It receives the packets 
listed in the table above all at about the same time, in the order listed, during a 
period in which the output port is busy but all queues are otherwise empty. Give 
the order in which the packets are transmitted for 
 
a. Fair Queueing. 
i. 1, 6, 4, 2, 5, 7, 3, 8 
 
b. Weighted fair queuing with flow 2 having twice as much share as flow 1, 
and flow 3 having three times as much share as flow 1. 
i. Can build a table using the weighted size instead of the size of a 
packet where the weighted_size = size / weight_of_flow 
 
 
 
Packet #  Weighted Size  Flow 

1  70  1 

2  210  1 

3  100  1 

4  130  2 

5  10  2 

6  80  3 

7  30  3 

8  60  3 
 
ii. 1, 6, 7, 4, 5, 8, 2, 3 
Note: Resolve ties in the order of flow 1, flow 2, and flow 3 
 
 
 
 
2. Token Bucket Filter 
Assume that a host is sending a router packets that it would like the router to 
forward. The router has implemented traffic policing using a token bucket filter as 
shown in the lecture slides. The token bucket has a fill rate of “r” bits per second 
(bps) and has a depth of “b” bits. 
 
For simplicity assume that data can be sent as individual bits rather than packets. 
Assume the average rate at which the host sends the router data follows the 
figure below and that the token bucket is initially full when time is 0. 
Show your work for all parts of this problem. 
 
 
a. If r = 1000 bps and b = 500 bits, will there be any loss of data? If so, at 
what time will the data loss start occurring? 
i. In the first second, the bucket is filling faster than it’s being drained, 
and the bucket is full, so it’s still full when time = 1. 
ii. Between 1 and 2 seconds, the buckets is being drained 500 bps 
faster than it is filling, so the bucket is empty at 2 seconds. 
iii. Between 2 and 3 seconds, the bucket is still trying to be drained at 
500 bps faster than it is filling with an empty bucket which means 
every other “bit” would be dropped. 
iv. After 3 seconds, the fill rate is always greater or equal to the drain 
rate, so there will be no more loss. 
v. So, yes there will be loss of data that starts when time is 2 seconds.  
 
b. Keeping r = 1000 bps, what is the minimum bucket depth “b” needed for 
the host to successfully meet the demand of the figure above? 
i. The only time the bucket is drained faster than it is filling is between 
1 and 3 seconds. The bucket drains 500 bps faster than it fills in 
this time window. 
ii. So, 500 bps for 2 seconds gives a bucket needed bucket depth of 
1000 bits. 
 
3. Network Address Translation 
NAT, is the translation of an Internet Protocol address (IP address) used within 
one network to a different IP address known within another network. Recall, a 
NAT capable router essentially translates private address within a network to 
public addresses that can be used publicly on the internet. 
 
In this question, we look at the inner workings of a simple NAT capable router. 
The router will have mappings between the private addresses within the network 
(here, the private addresses all fall within the 10/8 network) to the public 
address(es) that it uses. Let us assume that the router has a single public 
address 72.24.47.124 which it uses for all communication with hosts that are not 
part of the private network. The router multiplexes its public IP address(es) as 
needed and keeps track of the multiplexing in a NAT translation table. 
 
Assume that the router multiplexes the public address using ports starting from 
9000 and then incrementing by one. For example, if a host in the private network 
with address 10.0.0.5:6000 sends a message to 132.239.8.45:80 then the entry 
in the NAT table would be filled in as below. The next time the router will use 
9001 as the port to establish a new connection and so on. 
 
 
NAT Translation Table 

WAN Side Address  LAN Side Address 

72.24.47.124:9000  10.0.0.5:6000 

...  ... 
 
 
a. What would be the entries in the NAT Translation Table at the end of the 
following events 
i. 10.0.0.6:5000 sends a message to 74.125.239.33:80 
ii. 10.0.0.10:6000 sends a message to 204.79.197.200:80 
iii. 10.0.1.101:6001 sends a message to 206.190.36.45:80 
iv. 10.0.0.10:6000 sends another message to 204.79.197.200:80 
v. 10.0.1.101:6001 sends a message to 74.125.239.33:80 
vi. 10.0.0.7:7000 sends a message to 63.245.215.20:80 
vii. 204.79.197.200:80 sends a message to 10.0.0.10:6000 
viii. 206.190.36.45:80 sends a message to 74.125.239.33:80 
 
Note: The NAT Table should be like the one above with the entries 
generated from the events in (a.) filled in 
 
 
NAT Translation Table 

WAN Side Address  LAN Side Address 

72.24.47.124:9000  10.0.0.5:6000 

72.24.47.124:9001  10.0.0.6:5000 

72.24.47.124:9002  10.0.0.10:6000 

72.24.47.124:9003  10.0.1.101:6001 

72.24.47.124:9004  10.0.0.7:7000 
 
Events iv, v, vii, and viii have no impact on the NAT Translation Table 
 
 
b. For simplicity, let us assume that message format is MSG<Sender, 
Receiver>. In that case, if a host in the private network with address 
10.0.0.5:5000 sends a message to 132.239.8.45:80 then the message 
recevied at the router and leaving at the router would look as follows 
 
Message Received from Host: MSG<10.0.0.5:5000, 132.239.8.45:80> 
Message Sent from Router: MSG<72.24.47.124:9000,132.239.8.45:80> 
 
Note: We will need to use the entries from the table we filled in (a.) to do 
this. 
 
List out the message received from the host at the router and the 
message sent from the router (like shown above) for the following 
messages: 
i. 10.0.0.6:5000 sends a message to 74.125.239.33:80 
 
Message Received from Host: MSG<10.0.0.6:5000, 
74.125.239.33:80> 
Message Sent from Router: MSG<72.24.47.124:9001, 
74.125.239.33:80> 
 
ii. 10.0.0.10:6000 sends a message to 204.79.197.200:80 
 
Message Received from Host: MSG<10.0.0.10:6000, 
74.125.239.33:80> 
Message Sent from Router: MSG<72.24.47.124:9002, 
74.125.239.33:80> 
 
c. If the router gets a message MSG<74.125.239.33:80, 
72.24.47.124:9001>, what would the message look like leaving the router? 
 
MSG<74.125.239.33:80, 10.0.0.6:5000> 
 
d. Finally, if the router gets a message MSG<10.0.0.10:6000, 
10.0.1.101:6001>, what what would the message look like leaving the 
router? 
 
No change to the message because they are both private addresses. 
 
 
4. TCP Behavior 
The figure below shows the behavior of a TCP connection implementing the TCP 
Reno flavor of TCP including slow start, congestion avoidance, fast retransmit, 
and fast recovery. Every letter in the figure denotes a part of the graph divided by 
the vertical dashed lines that can be described by one of the phrases in the word 
list also given below. For every letter in the graph (a­h), give the phrase from the 
word list that best describes that part of the graph. The phrases in the word list 
can be used more than once and possibly not at all. 
 
 
 
 
Word List 
Quality of Service  Additive Increase  Maximum Segment Size 
 

Fast Retransmit +  Slow Start  Timeout 


Fast Recovery 
 
 
a. Slow Start 
b. Fast Retransmit + Fast Recovery 
c. Additive Increase 
d. Fast Retransmit + Fast Recovery 
e. Additive Increase 
f. Timeout 
g. Slow Start 
h. Additive Increase 
 
 
 
 
5. TCP Slow Start Extension 
Assume that TCP implements an extension that allows window sizes much larger 
than 64KB. Suppose that you are using this extended TCP over a 1­Gbps link 
with a constant one­way latency of 50 ms to transfer a 10MB file, and the TCP 
receive window is 16MB. If TCP sends 1KB packets (assuming no congestion 
and no lost packets): 
a. How many RTTs does it take until slow start opens the send window to 
1MB? 
i. We start with a window size of 1 KB that doubles every RTT. The 
mathematical way to solve this is to realize that 1 MB is 1024 times 
the size of 1 KB. We can then take log base 2 of 1024 which is 
equal to 10. 
ii. So, it would take 10 RTTs until the send window becomes 1MB 
b. How many RTTs does it take to send the file? 
i. When our window size became 1MB it means we’ve sent 1KB + 
2KB + 4KB + … + 512KB = 1MB ­ 1KB. The only bound we have 
on our window size is the receive window which is 16MB because 
the TCP algorithm won’t set the send window larger than the 
advertised window which is never larger than the receive window. 
Until this limit is reached, the window size will keep doubling. 
ii. First let’s calculate how much still needs to be sent: 10MB ­ (1MB ­ 
1KB) = 9MB + 1KB. To keep things clean let’s put the rest in a 
table.  
 
RTT  New Send Window  Remaining Data 

10  1MB  9MB + 1KB 

11  2MB  8MB + 1KB 

12  4MB  6MB + 1KB 

13  8MB  2MB + 1KB 

14  ­­­  DONE 


 
iii. So, it would take 14 RTTs to send the whole file. 
 
c. If the time to send the file is given by the number of required RTTs 
multiplied by the RTT, what is the effective throughput for the transfer? In 
other words, what percentage of the link bandwidth is utilized? 
i. The round trip time (RTT) is the 2­way delay which is 100 ms in this 
problem. Thus, the time it took to send the file was 14 * (100 ms) = 
1.4 s. 
ii. To find the link utilization for that time, we compare the amount of 
data that was sent with the amount of data that could have been 
sent during that time. We sent a 10MB file. Using a 1Gbps link, in 
1.4 seconds, 1.4 * 10^9 bits could have been sent. An exact answer 
for a percentage precise to 2 decimal places would then be (10 * 
2^20 * 8) / (1.4 * 10^9) = 0.0599 = 5.99% of the link. An estimate 
assuming that 1MB = 8 * 10^6 bits would be about 5.71%.  
 
 
 
 
IGURE 3.10 Extended LAN with loops.

3. (15 pts) Bridging. Consider the extended LAN shown below.

a) (5pts). Indicate which ports are not selected by the spanning tree algorithm.

Copyright © 2012, Elsevier Inc. All rights Reserved


B7’s port to network B, B3’s ports to network A and C, and B6’s ports to I and G will be
disabled.

b) (10pts). What happens if bridge B2 fails? Why (i.e., what messages will/will not be exchanged)?

B3’s ports will be re-enabled because B3 will stop receiving announcements from B2 and
instead will become “best” for network C.

5
4. (40 pts) IP forwarding. Consider the network diagram below. Each router (a square in the figure)
is labeled with the names of its interfaces (e.g., eth0) and the IP addresses assigned to each. Each
network (a circle) is labeled with its network name and prefix length.

R2

192.168.1.1

192.168.1.3
eth0

187.200.4.129
A eth3 R1 eth1
187.200.4.1
C

eth2
187.200.4.128/26 187.200.4.193 187.200.4.0/25

187.200.4.192/26

The forwarding table at R1 contains the following entries:

Destination Next Hop Interface


127.0.0.1/32 127.0.0.1 lo0
default 192.168.1.1 eth0
192.168.1.0/24 eth0
187.200.4.0/25 eth1
187.200.4.192/26 eth2
187.200.4.128/26 eth3

6
a) (5pts). Suppose the following IP packet arrived at a router R1. (Only a subset of the header
fields are shown.) Which entry in the forwarding table would it match?

IP Src IP Dst Payload


187.200.4.165 187.200.4.83 ...

187.200.4.0/25 eth1

b) (5pts). On which port on R1 must the packet above have arrived?

eth3

c) (10pts). How many hosts can network C accomodate (assuming unique IP addresses were the
only constraint)?

27 −3 = 125; as the all-zeros address is reserved for the network name, the all-ones address
is reserved for broadcast, and one address is used by the router’s interface.

d) (10pts). What is a legal IP address for a host on network B?

Any address between 187.200.4.194 and 187.200.4.254 is fine (187.200.4.193 is used by the
router).

e) (10pts). Imagine R2 uses aggregation to maintain precisely one entry in its forwarding table to
describe networks A, B, and C. What would that entry look like? (Give both the network name
including prefix length and the next hop.)

Destination Next Hop Interface


187.200.4.0/24 192.168.1.3 ...

7
CSE 123: Computer Networks - Spring 2019 - Homework 2
(Due 04/29 @ 10pm on Gradescope)

Name: PID:

UCSD email:

For the multiple choice questions, please fill in the circle for the correct answer. For the free-response
questions, please write clearly and ensure that your answer fits in the box provided.
Turn in before 04/29 at 10pm on Gradescope.

Switching/Bridging
1. (14 points) Consider hosts A, B, C, D, E, F, G and learning switches/bridges S1, S2, S3, S4, with
their corresponding port numbers marked as shown. Assume the switches were just powered on so their
forwarding tables are empty. Also assume that entries added to each forwarding table do not have a
timeout.

1
3
C S4 E

4
1 1
2 3 2 3
A S1 S2 F

4 4
1
3
B S3 G
(a) (6 points) Given that hosts send packets to each other in the following order, list all of the hosts
and switches that receive each packet.
1. M1: Host A sends a packet to Host B
B, C, D, E, F, G, S1, S2, S3, S4
2. M2: Host A sends a packet to Host C
B, C, D, E, F, G, S1, S2, S3, S4
3. M3: Host E sends a packet to Host A
S4, S2, S1, A
4. M4: Host C sends a packet to Host A
S1, A
5. M5: Host B sends a packet to Host C
S1, C
6. M6: Host G sends a packet to Host E
S3, S2, S4, E
(b) (6 points) Fill in the forwarding table for switch S2 as it will look after the above six packets have
been sent (note: some entries may be unused).

Host Port

A 2

E 1

G 4

(c) (2 points) With this forwarding table, will switch S2 know the exact port to send a packet when it
receives a packet from host A destined to any other host on the network? Answer: False
True
False

Page 2
Spanning Tree Protocol
2. (15 points) Consider the LAN topology shown below, where B1-B8 are bridges with their corresponding
links numbered.

A
1

B1
8 B
C 2
5
6
3
B3
B4 B6
D 9

4 7
E F
10

11 12

B7

13 14

G H
15 17

19
B5 B2

I 16 18
J
(a) (5 points) After the spanning tree algorithm converges, what links will be deactivated?
• B7 will disable port 11 because for LAN E, B4 is the lowest cost path to the root.
• B7 will disable port 12 because for LAN F, B6 is the lowest cost path to the root.
• B5 will disable port 16 because for LAN I, B2 is the lowest cost path to the root.

Page 3
(b) (6 points) After the spanning tree algorithm converges, what are the configuration messages sent
by bridges B4, B5, and B7? Use the following notation for spanning tree messages from bridge X
which claims to be distance d from root bridge Y : “(Y, d, X)”. For example, the first message sent
by bridge B7 is (B7, 0, B7).
• (B1, 1, B4)
• (B1, 3, B5)
• (B1, 2, B7)
(c) (4 points) Assume that some time after the spanning tree protocol converges, bridge B1 dies (lets
out the magic smoke). What is the new root bridge? What links are deactivated by the spanning
tree algorithm with this new root?
B2 will be the new root bridge because it has the lowest bridge number.
• B7 will disable port 13 because for LAN G, B5 is the lowest cost path to the root.
• B6 will disable port 6 because for LAN B, B3 is the lowest cost path to the root.
Links 1 and 2 will also be deactivated due to the dead B1, so it is OK to mention
them.

IP Fragmentation
3. (10 points) Suppose a router receives an IP packet from a network with an MTU of 1,500 bytes. The
packet has the following fields set in its header:

Length = 360 ID = 77 MF = 0 DF = 0 Offset = 0 TTL = 7

Now the router has to send this packet to a network with a smaller 300 byte MTU. Note that the MTU
refers to the largest link-layer frame, the IP header always consumes 20 bytes of the frame.

(a) (5 points) How many fragments will the router transmit?


2

Page 4
(b) (5 points) For each fragment, list the fields in their IP headers: Length, ID, MF, DF, offset, and
TTL. Note that the “offset” indicates position in the current fragment (in bytes/8).
Length = 300 ID = 77 MF = 1 DF = 0 Offset = 0 TTL = 6
Length = 80 ID = 77 MF = 0 DF = 0 Offset = 35 TTL = 6

Project 1 Debug
4. (10 points) One of your classmates is working on project 1, and writing a function is ack in window(uint8 t
ACK, uint8 t LAR, uint8 t LFS). Here is the function that your classmate wrote:

// Returns true of ACK is inside of the sender’s window. Return false otherwise.
static bool is_ack_in_window(uint8_t ACK, uint8_t LAR, uint8_t LFS)
{
return LAR < ACK && ACK <= LFS;
}

This is a sender side function that checks whether the acknowledgement number (ACK) of a received
frame is within the sender’s sliding window. If it is not, the function should return false, and thus
the sender knows to drop the frame. LAR is the acknowledgment number of the Last Acknowledgment
Received (left bound of the sender’s sliding window), and LFS is the sequence number of Last Frame Sent
by the sender (right bound of the sender’s sliding window). Sequence and acknowledgement numbers
are both 8-bit long. The sender and the receiver have the same window size.

(a) (5 points) Which issue does this function fail to address?


The sequence number may wrap around, and thus LAR might be numerically larger
than LFS. For example, assume that SWS = 7, LAR = 250, LFS = 1 ((uint8 t) (250+7)
== 1), and a received ACK equals 252. In this case, ACK is a valid number since it
is inside of the sliding window. However, the above function will return false.

Page 5
5. Sliding Window Protocol [7 points]
Draw a timeline diagram for the sliding window algorithm with SWS = RWS = 4
frames, for each of the following two situations. Use a timeout interval of about
2.5 × RTT. Assume fast retransmission with selective retransmission is
implemented and that packets with sequence numbers 1-6 will be sent. For fast
retransmission, if more than 1 duplicate ACK is received, only retransmit on the
first duplicate ACK.
a. Frame 2 is lost on the first transmission.
b. Frames 4 and 5 are lost on their first transmissions.

7 pts total
● 3 pts for a
○ 1 pt for sending first window and dropping frame 2
○ 1 pt for ACKing 1 until 2 gets retransmitted
○ 1 pt for fast-retransmission of 2
● 4 pts for b
○ 1 pt for sending first window and dropping frame 4
○ 1 pt for dropping frame 5
○ 1 pt for fast-retransmission of 4
○ 1 pt for timeout and retransmission of 5 and 6
General -1 pt for oddities in each answer
6. Learning Bridges [6 points]
Use the diagram below to answer the following questions. Assume the circles are
bridges and the rectangles are LANs with hosts represented by letter(s) inside
the rectangle. All bridges have empty tables at the beginning and the events
below occur in the order presented.

a. H sends a packet to D, who receives the packet?


i. All hosts
b. G sends a packet to H, who receives the packet?
i. E and H
c. D sends a packet to G, who receives the packet?
i. C and G
d. H sends another packet to D, who receives the packet?
i. E and D
e. H sends a packet to E, who receives the packet?
i. All hosts
f. E sends a packet to C, who receives the packet?
i. All hosts

6 points total
● 1 pt for correctness of each of a-f
7. Spanning Tree Question [6 points]
Given the extended LAN shown below, indicate which ports are not selected by
the spanning tree algorithm.

6 points total
● 2 pts for B6
○ 1 pt for each cut of B6 (2 possible)
● 2 pts for B7
○ 1 pt for cutting the top link
○ 1 pt for not cutting any other links
● 2 pts for B5
○ 1 pt for cutting the bottom link
○ 1 pt for keeping the connection to J open
General -1 each wrongly pruned link
CSE 123: Computer Networks
Homework 2 Solutions
Total points = 50

Problems
1. The Domain Name System (DNS) [6 points]
In the figure below, the first two steps are shown in the process of the local DNS
resolver resolving the name “cseweb.ucsd.edu”. Assume that the local DNS
resolver is configured to contact a root domain server directly. It would be a good
idea to read section 9.3.1 in the book (P&D) before answering this problem.

a. Complete the rest of the steps in the illustration to finish the resolution of
cseweb.ucsd.edu given the records each server contains below. Please
refer to figure 9.18 on page 755 of your book if you need to see the
expected format of the answer. Note, you may not need to use every
server (rectangle) in the illustration above.
a.root-servers.net: <edu, a3.nstld.com, NS, IN>
<a3.nstld.com, 140.22.51.76, A, IN>
a3.nstld.com: <ucsd.edu, dns.ucsd.edu, NS, IN>
<dns.ucsd.edu, 172.111.222.3, A, IN>
dns.ucsd.edu: <cseweb.ucsd.edu, 132.239.8.30, A, IN>

See the filled in illustration above for the answer.

6 points total
● 1 pt for each arrow with correct information and order (6 in all)
○ -1 total pt if arrows are almost correct, but consistent
○ -1 total pt if accessing cseweb.ucsd.edu

2. NAT [8 points]
NAT, is the translation of an Internet Protocol address (IP address) used within
one network to a different IP address known within another network. Recall, a
NAT capable router essentially translates private addresses within a network to
public addresses that can be used publicly on the internet.

In this question, we look at the inner workings of a simple NAT capable router.
The router will have mappings between the private addresses within the network
(here, the private addresses all fall within the 172.16.0.0/12 network) to the public
address that it uses. Let us assume that the router has a single public address
98.5.23.7 which it uses for all communication with hosts that are not part of the
private network. The router multiplexes its public IP address as needed and
keeps track of the multiplexing in a NAT translation table.

Assume that the router multiplexes the public address using ports starting from
4000 and then incrementing by one. For example, if a host in the private network
with address 172.16.0.5:9000 sends a message to 132.239.8.45:80 then the
entry in the NAT table would be filled in as below. The next time the router will
use 4001 after receiving a packet with a new LAN side IP and port pair and so
on. Think of a message as a packet (using TCP) in this context.
NAT Translation Table

WAN Side Address LAN Side Address

98.5.23.7:4000 172.16.0.5:9000

98.5.23.7:4001 172.16.0.6:5000

98.5.23.7:4002 172.16.1.10:6000

98.5.23.7:4003 172.16.5.3:9001

98.5.23.7:4004 172.16.0.10:6000

98.5.23.7:4005 172.20.0.7:7000

a. What would be the entries in the NAT Translation Table at the end of the
following global events (keeping the first entry from the table above).
Assume the router implementing NAT is connected to the internet and can
reach any public IP address and vice-versa.
i. 172.16.0.6:5000 sends a message to 206.190.36.45:80
ii. 172.16.1.10:6000 sends a message to 204.79.197.200:80
iii. 172.16.5.3:9001 sends a message to 206.190.36.45:80
iv. 172.16.0.10:6000 sends a message to 173.16.0.6:22
v. 172.16.5.3:9001 sends a message to 74.125.239.33:80
vi. 172.20.0.7:7000 sends a message to 63.245.215.20:80
vii. 206.190.36.45:80 sends a message to 172.16.0.6:5000
viii. 204.79.197.200:7000 sends a message to 74.125.239.33:80

Note: The NAT Table should be like the one above with the entries
generated from the events in (a.) filled in

Only events i, ii, iii, iv, and vi modified the NAT table. Event v just uses the entry that’s
already in the table for that local ip and port. Events vii and viii were originally meant to
be “global events”, as mentioned in the part a description, but many perceived this
problem as being that the router sees all of the messages from above, so I will grade
from that perspective too.

If you took everything as being “global events” then event vii would mean that if some
host 206.190.36.45 tried to send to 172.16.0.6 then it would never actually make it
through the Internet to get to this NAT enabled router because it is a bogon. As such it
would have no effect on this router’s NAT table. If you understood it as the router
receiving the messages all listed, then you can assume that the router would do a LPM
on its forwarding table and find a match for the private subnet it is attached to, so the
message would be forwarded without modification. This would also not cause the NAT
table to change. The same arguments basically apply for viii as well. If the message
being sent is treated as a “global event” then the message should never reach the
router because that’s not the router’s public IP address. If treated as the router receiving
the message, then it would be forwarded back towards the internet because that’s what
would be matched in the forwarding table. Neither would cause a change to the NAT
table.

b. For simplicity, let us assume that message format is MSG<Sender,


Receiver>. In that case, if a host in the private network with address
172.16.0.5:9000 sends a message to 132.239.8.45:80 then the message
recevied at the router and leaving at the router would look as follows

Message Received from Host: MSG<172.16.0.5:9000, 132.239.8.45:80>


Message Sent from Router: MSG<98.5.23.7:4000, 132.239.8.45:80>

Note: We will need to use the entries from the table we filled in (a.) to do
this.

List out the message received from the host at the router and the
message sent from the router (like shown above) for the following
messages:
i. 172.16.5.3:9001 sends a message to 74.125.239.33:80
Message Received from Host:
MSG<172.16.5.3:9001, 74.125.239.33:80>
Message Sent from Router:
MSG<98.5.23.7:4003, 74.125.239.33:80>
ii. 172.16.1.10:6000 sends a message to 63.245.215.20:80
Message Received from Host:
MSG<172.16.1.10:6000, 63.245.215.20:80>
Message Sent from Router:
MSG<98.5.23.7:4002, 63.245.215.20:80>
c. If the router gets a message MSG<204.79.197.200:80,
172.16.1.10:6000>, what would the message look like leaving the router?

MSG<204.79.197.200:80, 172.16.1.10:6000>
I will be lenient on grading this problem because realistically the router
should not get a message like this that presumably would have come from
the Internet. If you mentioned the packet should have been dropped you’ll
get credit.

d. Finally, if the router gets a message MSG<172.16.1.10:6000,


172.16.5.3:9001>, what would the message look like leaving the router?

It would look the same because the message is not leaving the private
subnet: MSG<172.16.1.10:6000, 172.16.5.3:9001>

8 points total
● 4 pts for part a
○ -1 total pt if not all entries added
○ -1 total pt if extra entries added
● 2 pts for part b
○ 1 pt for part i correctness
○ 1 pt for part ii correctness
● 1 pt for part c for correctness
● 1 pt for part d for correctness

3. Distance-vector routing [9 points]


For the network shown below, give the global distance-vector tables like those in
Tables 3.10 and 3.13 on pages 244 and 246 in the book (P&D) when
a. Each node knows only the distances to its immediate neighbors.

A B C D E F

A 0 2 8 3 Inf Inf

B 2 0 Inf Inf 1 Inf

C 8 Inf 0 Inf 6 1

D 3 Inf Inf 0 Inf Inf

E Inf 1 6 Inf 0 3

F Inf Inf 1 Inf 3 0

b. Each node has reported the information it had in the previous step to its
immediate neighbors.

A B C D E F

A 0 2 8 3 3 9

B 2 0 7 5 1 4

C 8 7 0 11 4 1

D 3 5 11 0 Inf Inf

E 3 1 4 Inf 0 3

F 9 4 1 Inf 3 0
c. Step “b.” happens a second time.

A B C D E F

A 0 2 8 3 3 6

B 2 0 5 5 1 4

C 8 5 0 11 4 1

D 3 5 11 0 6 12

E 3 1 4 6 0 3

F 6 4 1 12 3 0

9 pts total
● 3 pts for part a
○ -1 total pt if some rows are incorrect
● 3 pts for part b
○ -1 total pt if some rows are incorrect where correctness is based upon the
student answer from part a
● 3 pts for part c
○ -1 total pt if some rows are incorrect where correctness is based upon the
student answer from part b
4. Split Horizon and Poison Reverse [9 points]
Use the figure from part 3 to answer the following questions assuming the routers
are using Distance-vector routing with split horizon and poison reverse. Assume
that the network has settled long enough that the routers have all reached a
convergence. An example of the vectors that F would receive from its neighbors
is shown below.

Ex. vectors received by F


C:
A B C D E F

Inf Inf 0 Inf Inf Inf

E:
A B C D E F

3 1 Inf 6 0 Inf

a. Show the vectors A would receive from its immediate neighbors


D:
A B C D E F

Inf Inf Inf 0 Inf Inf

B:
A B C D E F

Inf 0 5 Inf 1 4

C:
A B C D E F

7 5 0 10 4 1
b. Show the vectors E would receive from its immediate neighbors
B:
A B C D E F

2 0 Inf 5 Inf Inf

C:
A B C D E F

7 5 0 10 4 1

F:
A B C D E F

Inf Inf 1 Inf Inf 0

c. Show the vectors C would receive from its immediate neighbors


A:
A B C D E F

0 2 7 3 3 6

E:
A B C D E F

3 1 4 6 0 3

F:
A B C D E F

6 4 Inf 9 3 0
9 points total
● 3 pts for part a
○ 1 pt for each correct distance vector
● 3 pts for part b
○ 1 pt for each correct distance vector
● 3 pts for part c
○ 1 pt for each correct distance vector
● *Note: “correct” is treated as meaning Inf is sent where needed and not sent
where not needed. As such, if 11 is put and 10 is expected, no points will be
taken. If 11 is put, but Inf is expected, a point will be taken.
○ This helps to be somewhat lenient to those who miscalculated what the
global table would be at convergence

5. Link-state routing [10 points]


Using the same network topology as in the figure in problem 3, draw a table like
Table 3.14 on page 258 in the book (P&D) that traces the steps for building the
routing table for node B.
Confirmed Tentative Comments

(B,0,-) Initial node

(B,0,-) (A,2,A) (E,1,E) B Neighbors

(B,0,-) (E,1,E) (A,2,A) Added E

(B,0,-) (E,1,E) (A,2,A) (C,7,E) (F,4,E) E Neighbors

(B,0,-) (E,1,E) (A,2,A) (C,7,E) (F,4,E) Added A

(B,0,-) (E,1,E) (A,2,A) (C,7,E) (F,4,E) (D,5,A) A Neighbors

(B,0,-) (E,1,E) (A,2,A) (C,7,E) (D,5,A) Added F


(F,4,E)

(B,0,-) (E,1,E) (A,2,A) (C,5,E) (D,5,A) F Neighbors; cheaper path


(F,4,E) found for C

(B,0,-) (E,1,E) (A,2,A) (D,5,A) Added C


(F,4,E) (C,5,E)

(B,0,-) (E,1,E) (A,2,A) (D,5,A) C has no new Neighbors


(F,4,E) (C,5,E)

(B,0,-) (E,1,E) (A,2,A) Added D; done


(F,4,E) (C,5,E) (D,5,A)

Note that C or D can be added first. The order doesn’t matter for those two. Also, if you
condensed the steps of adding a node to the confirmed list and adding its neighbors to
the tentative list, you should get full points assuming it's done correctly.

10 points total
● 1 pt for each addition of a correct node into the confirmed node (except for the
last one, so 5 total)
● 1 pt for each update of a node’s neighbors (5 total)
● -3 total pts for using link cost of next-hop for total cost rather than adding up the
links to get to the destination
● -1 pt for each error
○ I’ll try to follow the student through for points on consistency
○ A common error is using F as the next hop for C when the distance to C is
shortened after adding F as confirmed. E is still the next-hop from B.
6. End-to-End Router behavior [8 points]
For the below topology, rectangles are routers and circles are hosts. The
numbers inside the hosts and routers are numbered ports on the host or router.
The following lines represent the IP and MAC addresses of each port on the
hosts and routers in the topology.
A: 1- 78.64.1.5, 74-29-9C-E8-FF-55
R1: 1- 78.64.1.1, E6-E9-00-17-BB-4B
2- 78.64.2.1, CC-49-DE-D0-AB-7D
R2: 1- 78.64.2.2, 1A-23-F9-CD-06-9B
2- 78.64.3.1, 88-B2-2F-54-1A-0F
3- 78.64.4.2, 49-BD-D2-C7-56-2A
B: 1- 78.64.3.5, 2A-1A-CD-DE-E9-74
R3: 1- 78.64.4.1, E9-C7-2F-23-CC-55
2- 78.64.5.1, DE-D2-B2-1A-4B-FF
C: 1- 78.64.5.5, D2-B2-1A-7D-BB-E8

For the parts below assume that there is an ARP cache with no timeout. In other
words, if a given host or router has received an ARP reply for an IP they have
sent an ARP request for previously, they don’t need to send an ARP request
again. For each part list each step that occurs to get the packet from source to
destination like the example below:

Ex. Say host B sends a packet to R2 (specifically to ​78.64.3.1​)


Step 1​- B sends an ARP request on port 1 for 78.64.3.1
Step ​2- R2 responds on port 2 with 88-B2-2F-54-1A-0F
Step 3​- B sends the packet on port 1 with source IP 78.64.3.5, destination IP
78.64.3.1, source MAC address 2A-1A-CD-DE-E9-74, and destination MAC
address 88-B2-2F-54-1A-0F

Assume the ARP caches are empty before part a below. Part b will keep
whatever was cached from part a.
a. Host A sends a packet to B
Step 1​- A sends an ARP request on port 1 for 78.64.1.1
Step 2​- R1 responds on port 1 with E6-E9-00-17-BB-4B
Step 3​- A sends the packet on port 1 with source IP 78.64.1.5, destination IP
78.64.3.5, source MAC address 74-29-9C-E8-FF-55, and destination MAC
address E6-E9-00-17-BB-4B
Step 4​- R1 sends an ARP request on port 2 for 78.64.2.2
Step 5​- R2 responds on port 1 with 1A-23-F9-CD-06-9B
Step 6​- R1 sends the packet on port 2 with source IP 78.64.1.5, destination IP
78.64.3.5, source MAC address CC-49-DE-D0-AB-7D, and destination MAC
address 1A-23-F9-CD-06-9B
Step 7​- R2 sends an ARP request on port 2 for 78.64.3.5
Step 8​- B responds on port 1 with 2A-1A-CD-DE-E9-74
Step 9​- R2 sends the packet on port 2 with source IP 78.64.1.5, destination IP
78.64.3.5, source MAC address 88-B2-2F-54-1A-0F, and destination MAC
address 2A-1A-CD-DE-E9-74

b. Host A sends a packet to C


Step 1​- A sends the packet on port 1 with source IP 78.64.1.5, destination IP
78.64.5.5, source MAC address 74-29-9C-E8-FF-55, and destination MAC
address E6-E9-00-17-BB-4B
Step 2​- R1 sends the packet on port 2 with source IP 78.64.1.5, destination IP
78.64.5.5, source MAC address CC-49-DE-D0-AB-7D, and destination MAC
address 1A-23-F9-CD-06-9B
Step 3​- R2 sends an ARP request on port 3 for 78.64.4.1
Step 4​- R3 responds on port 1 with E9-C7-2F-23-CC-55
Step 5​- R2 sends the packet on port 3 with source IP 78.64.1.5, destination IP
78.64.5.5, source MAC address 49-BD-D2-C7-56-2A, and destination MAC
address E9-C7-2F-23-CC-55
Step 6​- R3 sends an ARP request on port 2 for 78.64.5.5
Step 7​- C responds on port 1 with D2-B2-1A-7D-BB-E8
Step 8​- R3 sends the packet on port 2 with source IP 78.64.1.5, destination IP
78.64.5.5, source MAC address DE-D2-B2-1A-4B-FF, and destination MAC
address D2-B2-1A-7D-BB-E8
8 points total
● 4 pts for part a
○ -1 total pt for missing any or incorrect ARP requests
○ -1 total pt if used an incorrect MAC Address
● 4 pts for part b
○ -1 total pt for missing any or incorrect ARP requests
○ -1 total pt for adding any unnecessary ARP requests
○ -1 total pt if used an incorrect MAC Address
● -2 total pts for changing ip address in packet
● -2 total pts for omitting details such as source address and destination addresses for
either MAC or IP addresses
CSE 123: Computer Networks
Homework 3 Solutions
Total points = 50

Problems
1. BGP Routing [10 points]
Consider the network shown below, in which horizontal lines represent
Autonomous Systems (AS), and numbered vertical lines are inter-provider links.
A, B, C, D, and E are networks connected to a particular provider below
(customers within an AS). The numbered links 1, 2, 3, 4 and 5 show the peering
links between the providers. For the purposes of this problem, a route can be
written as a comma separated path from one provider to another. Ie. the route
from C to A through Provider P would be “<Q, P, S>.” Take note that in an
all-knowing sense there are actually two other routes from C to A, namely <Q,S>
and <Q,R,S>, but depending on the business relationships between the
providers, only certain routes will be advertised.
a. Suppose that P, Q, R, and S are peer autonomous systems to the other
autonomous systems to which they have direct links. Ie. S has a peer
relationship to P, Q, and R, but R only has peer relationships to Q and S
because it has no direct link to P. Remember, a route can only be used if
network’s attached provider has received an advertisement for the
destination network. If there is no route that would be used, say so.
i. What route would D use to send traffic to network C?

<R, Q> only because an AS only advertises its customers to its


peers, it doesn’t share routes to another peer’s customers

ii. What route would B use to send traffic to network D?

There is none for basically the same reason as above

b. Now suppose providers P, Q, R, and S adopt the policy that outbound


traffic is routed to the “closest” inter-provider link that it knows is on a route
to the destination, thus minimizing their own cost (e.g., S would prefer to
use link 1 for any outbound traffic from network A because link 1 is closest
to A, but it can only use link 1 if there is a known route to the destination
that has P next in the route). Assume that relationships are different from
part a, so now P, R, and S are all customers of Q. Additionally, P and S
are peers, and S and R are peers. If there is no route that would be used,
say so.
i. What route would B use to send traffic to network A?

<P, Q, S>

ii. What route would A use to send traffic to network B?

<S, P>

iii. What route would D use to send traffic to network E?

<R, Q, S>

iv. What route would E use to send traffic to network C?

<S, Q>
c. Suppose the same as part b above in choosing the “closest” link, except
the autonomous system relationships have changed again. Now R is a
customer of S and S is a customer of P. Also, Q has peer relationships
with P, R, and S. If there is no route that would be used, say so.
i. What route would C use to send traffic to network B?

<Q, P>

ii. What route would C use to send traffic to network D?

<Q, S, R>

iii. What route would A use to send traffic to network C?

<S, P, Q>

iv. What route would D use to send traffic to network A?

<R, S>

10 points total
● 1 point for each answer
2. Input Queueing and Virtual Output Queueing [8 points]
Suppose we have a router with three input ports and three output ports. We will
consider one implementation that uses only input queueing for part a and then
another implementation that uses input queueing with virtual output queueing for
part b. No more packets are entering the input queues. All of the output ports run
at the same speed.

a. Let’s say the switching fabric in the illustration above runs fast enough to
take a single packet from each input queue and put it onto each output
queue in one “period”. For this problem a period will be the time it takes to
take a packet from the input queue and finish sending it out of an output
queue. Consider scheduling time to be trivial. Assume the scheduling
algorithm is as follows for each period (it is unfair, but simple):
● If input queue 1 is not empty, send whatever is at the head
● If input queue 2 is not empty, send whatever is at the head unless
the output port corresponding to the packet at the head is already
being used this period
● If input queue 3 is not empty, send whatever is at the head unless
the output port corresponding to the packet at the head is already
being used this period
i. How many periods will it take to empty all of the input queues?
Please mention what packets are sent in each period. As an
example, in the first period a packet from the red flow is sent from
input queue 1 while no packets from input queues 2 and 3 can be
sent yet. Thus, you could write, “P1 - 1 sends red”. This signifies
that in the first period, P1, input queue 1 has a packet from the red
flow sent and nothing is sent from input queues 2 and 3.

Input Queue = IQ, P# = period number

P1- 1 sends red


P2- 1 sends red
P3- 1 sends green, 2 sends red
P4- 1 sends blue, 2 sends red
P5- 1 sends blue, 3 sends red
P6- 2 sends blue, 3 sends red
P7- 2 sends blue
P8- 3 sends blue
P9- 3 sends green
P10- 3 sends green

So it would take 10 periods to empty all of the input queues.


b. Take a moment to realize that the illustration above starts with the same
packets in the input queues as in part a except now we are also using
virtual output queueing (pay no attention to the change in scale of the
packets). Treat everything the same as part a except now each input
queue has three virtual output queues that will scheduled in the
preference of red, green, then blue.

i. Now how many periods will it take to empty all of the input queues?
Please mention what packets are sent in each period like in part a.

P1- 1 sends red, 2 sends blue, 3 sends green


P2- 1 sends red, 2 sends blue, 3 sends green
P3- 1 sends green, 2 sends red, 3 sends blue
P4- 1 sends blue, 2 sends red
P5- 1 sends blue, 3 sends red
P6- 3 sends red

So it would take 6 periods to empty all of the queues.


8 points total
● 4 points for part a
● 4 points for part b
● -1 point total if no work
● -1 point if answers are almost right

3. Scheduling and QoS [8 points]

Packet # Size Flow

1 100 1

2 140 1

3 180 2

4 120 2

5 60 2

6 110 3

7 80 3

8 90 3

Suppose a router has three input flows and one output. It receives the packets
listed in the table above all at about the same time, in the order listed, during a
period in which the output port is busy but all queues are otherwise empty. Give
the order in which the packets are transmitted for
a. Fair Queueing.

Within a given flow we still want to make sure that we send the packets in
order. This allows things like TCP to perform best because out of order
packets can cause duplicate acknowledgements to be sent unnecessarily.

Flow 1: 1- 100, 2- 240


Flow 2: 3- 180, 4- 300, 5- 360
Flow 3: 6- 110, 7- 190, 8- 280

1, 6, 3, 7, 2, 8, 4, 5

b. Weighted fair queuing with flow 1 having twice as much share as flow 3,
and flow 2 having three times as much share as flow 3.

We can rewrite the table given using the weights for each flow and the
size of each packet. The “weighted size” is relative to the amount of
weight that flow 3 gets. So packets from flow 1 will have a weighted size of
“packet size/ 2” and flow 2 will have a weighted size of “packet size/ 3”.

Packet # Weighted Size Flow

1 50 1

2 70 1

3 60 2

4 40 2

5 20 2

6 110 3

7 80 3

8 90 3
8 points total
● 3 points for a correctness
○ -1 point if answers are close and show work
● 3 points for b correctness
○ -1 point if answer is close and shows work
● 2 points for c correctness
○ -1 point if answer is close and shows work

6. Sharing the Ethernet [8 points]


In this problem, for each scenario, there will be some number of hosts on a LAN
using the Ethernet protocol. An example scenario is given below followed by the
answer for the example scenario in Figure 2. The light blue boxes with a letter in
them means that the host with that letter is successfully transmitting on the
channel. The red boxes indicate that a collision has occurred. Each numbered
column is a time period of 1us. We’ll also make a few simplifying assumptions:
● When a collision occurs, it takes 1us before the Ethernet channel is free
again
● A host that has collided will choose its exponential backoff value at the
end of the 1us in which the collision occurred
● Exponential backoffs are calculated using 1us time periods (ie. an
exponential backoff of 3 will cause a wait of 3us before attempting to
transmit again)
● Each host needs to use 3us to successfully transmit a packet
● Each host only needs to successfully transmit 1 packet

Ex.
Consider the following scenario. Suppose there are some hosts A, B, and C on a LAN.
A and B make their first attempt to transmit (starting with carrier sense) while C is
successfully transmitting the last 1/3 of a packet in time period 0. Also, let’s say we
know that values that will be randomly chosen by each host after each collision shown
in Figure 1. The table’s rows are each host and the columns are the exponential backoff
choices. Using this knowledge we can create a table of what would happen on the
Ethernet channel during each time period shown in Figure 2. Note that only the first two
columns of Figure 1 are used by each host because it turns out each host only
experiences two collisions in this example.
K = 0...1 K = 0...3 K = 0...7

A 1 2 6

B 1 0 4

Figure 1

0 1 2 3 4 5 6 7 8 9
C B A
A&B
random B A attempts
same randomly after having A transmits
backoff of backs off 0 randomed after it
A&B A&B 1 and and a backoff of stops
attempt collide collide transmits 2 hearing B

Figure 2

* Disregard the varying widths of the time periods as that occurred only to allow
comments to be fit in the last row of the table

a. Now consider a slightly more complicated problem. Suppose there are


hosts A, B, C, and D on a LAN. Hosts B and C make their first attempt to
transmit while host A is successfully transmitting the last 1/3 of its packet
at time period 0. Host D makes its first attempt to transmit at time period 7.
The first table provided contains the exponential backoffs that will be
chosen by each host when a collision occurs. Fill in the second table with
the events that would follow from this description like in the example that
is given to you above.

K = 0...1 K = 0...3 K = 0...7

B 0 3 5

C 0 2 3

D 1 1 7
0 1 2 3 4 5 6 7 8 9
A C

C B
B&C randoms attempts D
random a to attempts
same backoff transmit to
backoff of 2 and after a transmit
B&C B&C of 0 and transmit backoff for the B&D
attempt collide collide s of 3 first time collide

10 11 12 13 14 15 16 17 18 19
D B

D
randoms
a B now
backoff transmit
of 1 and s after a
transmit backoff
s of 5

* You will be graded first on what you put in the row 1 of each time period. Giving a brief
description of what’s happening at each time period is recommended for partial credit. If
you do not want to use color in your table, please make it clear what event is occurring
at each time period. A simple legend may be useful to ensure you are graded properly.

8 points total for correctness


● -2 point total if hosts don’t transmit for 3 time periods
● -1 point total if it doesn’t have the first two collisions
● -1 point for each host not in the correct position
3. (15 pts) Learning bridges. Consider the extended LAN shown below. Assume all bridges were just
turned on and no frames have been sent. Three frames are subsequently sent in the order described
below.

B2 C

D
B1
E F

B3
G
H J

a) (5pts). Suppose host J sends a frame to host C. List the hosts that receive the frame.

A, B, C, D, E, F, G, and H.

b) (5pts). Afterwards, host E sends a frame to J. What hosts receive that frame?

F, H, and J.

c) (5pts). Finally, host D sends a frame to E. Which hosts receive this frame?

A and E.

4
4. (30 pts) IP Addressing. Consider the IP address 132.239.15.87.

a) (6 pts). Suppose that we were still using class-based addressing. What type of network would
this IP address be a part of?

Class B.

b) (6 pts). If the network administrator had decided to break the network in part a) into 16 different
subnets, what would the subnet mask of the subnet to which this IP address belongs be?

11111111.11111111.11110000.000000000 or 255.255.240.0

c) (6 pts). What is the subnet number (address) of the subnet to which this IP address would be
attached?

132.239.0.0

d) (6 pts). Now suppose instead that we are using CIDR addressing instead of Class-based address-
ing and subnets. What would the length of CIDR prefix for the physical network in part c) to
which the host were attached be?

/20.

e) (6 pts). Suppose a router had a routing table with three entries: default (0/0), 132.239.8/21, and
the network in part d). Which entry would it use to forward a packet to 132.239.15.87? Why?

132.239.8/21, because it is the LMP.

5
CSE 473 – Introduction to Computer Networks Jon Turner
Exam 1 Solution
10/3/2012

1. (10 points). A user in St. Louis, connected to the internet via a 20 Mb/s (b=bits) connection
retrieves a 250 KB (B=bytes) web page from a server in Seattle, where the page references 4
images of 1 MB each. Assume that the one way propagation delay is 25 ms.

Approximately how long does it take for the page (including images) to appear on the user’s
screen, assuming non-persistent HTTP using a single connection at a time (for this part, you
should ignore queueing delay and transmission delays at other links in the network)?

5*(100) ms + (2 + 4*8 Mb/(20 Mb/s) = 500 ms + 1.7 sec = 2.2 seconds

How long does it take if the connection uses persistent HTML (single connection)?

100 ms + 50 ms + 1.7 sec = 1.85 seconds

Suppose that the path from the server to the user passes through a 1 Gb/s link at a router R,
and that the rate at which packets arrive at router R that must be sent on this link is 450,000
packets per second. If the average packet length is 2,000 bits, what is the average queueing
delay at this link?

I = (900 Mb/s)/(1 Gb/s) = 0.9, so average queue length = I/(1-I) = .9/.1 = 9 packets

time to send a packet = (2000 bits)/(1000 bits per µs)

average delay = 9*2 µs = 18 µs

-1-
2. (10 points). Suppose a server with IP address 1.2.3.4 executes the following lines of python.
sock = socket(AF_INET, SOCK_STREAM);
sock.bind((‘1.2.3.4’, 6789))
sock.listen(10)
connsock1, client1 = sock.accept()
connsock2, client2 = sock.accept()
Now, suppose a host with IP address 2.3.4.5 executes the following lines.
sockA = socket(AF_INET, SOCK_STREAM);
sockA.bind((‘2.3.4.5’, 23456))
sockA.connect((‘1.2.3.4’, 6789))
and a short while later, suppose another host with IP address 3.4.5.6 executes the following
lines.
sockB = socket(AF_INET, SOCK_STREAM);
sockB.bind((‘3.4.5.6’, 34567))
sockB.connect((‘1.2.3.4’, 6789))
At this point, how many sockets are there at the server?

How many port numbers are being used at the server (by this program)?

What is the value of the variable, client1, at the server?

((“2.3.4.5”,23456))

What is the value of the variable, client2?

((“3.4.5.6”,34567))

Give one line of python that causes the string “who hah” to be sent from the server to the
second of the two clients. What is the maximum possible number of packets that TCP might
use to deliver this string to the client?

connsock2.sendall(“who hah”)

This could require up to 7 packets.

-2-
3. (10 points). The figure below shows a host, its local DNS server, three additional DNS
servers and a web server (c.b.a.com). The tables at left represent the DNS caches for the local
server and the host. Suppose the user at the host enters c.b.a.comfoo.html into a web
browser.

.com
1.2.3.4

a.com
name address 2.3.4.5
.com 1.2.3.4

b.a.com 2.3.5.6

c.b.a.com 2.3.5.7 local


DNS b.a.com
2.3.5.6
server

c.b.a.com
2.3.5.7
name address
c.b.a.com 2.3.5.7
host

List all packets sent, leading up to the first packet sent from the host to the web server. For
each packet, identify the sender, the receiver and give a brief description of the packet (for
example, “query on name x.y.z” or “response IP=9.8.7.6”). Assume that the local server uses
recursive query processing, but all others use iterative query processing. Show all changes
to the contents of the DNS caches at the end of the sequence.

host to localDNS query on name c.b.a.com

localDNS to b.a.com query on name c.b.a.com

b.a.com to localDNS response IP=2.3.5.7

localDNS to host response IP=2.3.5.7

-3-
4. (10 points) Consider a packet with a total length of 250 bytes (including IPv4 header, with
no options) and an id field equal to 17, sent from a host A to a host B, passing through
routers X and Y. Assume that the subnet where host A is connected has an MTU of 500
bytes, the subnet where host B is connected has an MTU of 80 bytes and the subnet between
X and Y has an MTU of 120 bytes. Assuming that the “don’t fragment” flag is not set, how
many fragments does router X divide the packet into? What is the length of each fragment?

The payload has 230 bytes and each packet in the subnet joining X and Y has room for a 100 byte
payload, but since 100 is not divisible by 8, we’ll have 96 bytes in the initial fragments. So, there are
3 fragments with payload sizes of 96, 96 and 38 giving packet sizes of 116, 116 and 58.

Complete the diagram below so that it represents the first two fragments forwarded by
router Y (not X). Fill in all the blanks.

... ...

id=17 MF=1 offset=0 id=17 MF=1 offset=7

... ...

payload payload

length=56 length=40

Suppose host A sends a 50 byte packet with the “don’t fragment” flag set. Explain what
happens to this packet at each of the two routers.

This packet is shorter than the MTU of all subnets, so it will be delivered to B without any
fragmentation.

-4-
next hop
5. (10 points). The table at right represents a forwarding table for prefix output address
an IP router (for simplicity, we are using 8 bit addresses). 101* 2 1010 1111
0100* 4 0100 0110
If a packet arrives with destination address 1010 0110, what
0010 0* 6 -
output is it sent to, and what is the IP address of the next
1010 1* 7 -
network-level component to receive the packet?
0101 0* 5 0101 0011
1011 00* 3 1011 0000
output 2, address 1010 1111
0101 11* 1 0101 1100
0010 01* 9 -

If a packet arrives with destination address 0010 0110, what output is it sent to, and what is
the IP address of the next network-level component to receive the packet?

output 9, address 0010 0110

If a packet arrives with destination address 1011 0010, what output is it sent to, and what is
the IP address of the next network-level component to receive the packet?

output 3, address 1011 0000

Draw a diagram of a binary trie that could be uses as a lookup data structure for the prefixes
in the table. Mark each node that corresponds to a prefix in the table with an X.

0 1

0 1 0

1 0 1

X
0 1 0 1
0
X
0 0 1 1 0
X X X
1 1 0
X X X

-5-
6. (10 points). The diagram below shows a network with 3 routers (shown as hexagons)
connected by an Ethernet switch. The routing table for the left-hand router is shown.
Complete the routing table for the right-hand router, so that packets will be delivered
appropriately (use no more than 5 route table entries).

1.2.2.9 1.2.2.2

1.2.2.8 1 2 1.2.2.1
3
1.2.3.9 1.2.5.2
1.2.1.9
1.2.3.8 1.2.1.8
1 2
2 1
3 1.2.5.4 1.2.5.1 3
1.2.3.1 1.2.1.1

1.2.3.2 1.2.1.2
1.2.5.3
next hop next hop
prefix output ip
1.2.2.0/24 2 1.2.5.2 prefix output ip
1.2.1.0/24 2 1.2.5.1 1.2.2.0/24
1.2.5.0/24 2 -
1.2.3.0/24
1.2.3.0/29 3 -
1.2.3.8/29 1 - 1.2.5.0/24

1.2.1.0/29

1.2.1.8/29

If a switch was inserted between the host with IP address 1.2.3.2 and its router, how many
hosts could be added to that switch, without having to change the routing table entries?
What IP addresses would those hosts use?

A /29 prefix contains 8 addresses. Since 2 are already in use, so this leaves addresses 1.2.3.0, 1.2.3.3,
1.2.3.4, 1.2.3.5, 1.2.3.6 and 1.2.3.7. So 6 hosts could be added.

This is actually not quite right, since there is a special rule for subnets. The first address in any
subnet range (the address defined by all zeros) is generally interpreted as the “subnet address” and is
not supposed to be used by any host. In addition, the last address in any subnet range (the address
defined by all ones) is the “broadcast address” for the subnet and should not be assigned to a host.
This rule effectively eliminates hosts 1.2.3.0 and 1.2.3.7, so technically, only 4 hosts can be added.

-6-
7. (15 points) In the figure in problem 6, suppose that the server, with IP address 1.2 5.3 is
configured to use the right-hand router for its non-local traffic. Assume that the ARP tables
for all hosts and routers are empty initially. List all packets that must be sent from one
network-level component to another, in order to deliver a packet from the server to the host
with IP address 1.2.2.9. For each packet, specify which component sends it and which
receives it and give a brief description (for example – “left router to top router: ARP request
for address xyz”, or “server to top router: data packet”).

1. Server broadcasts ARP request for address 1.2.5.1.

2. Right-hand router responds with its MAC address.

3. Server sends packet with destination address 1.2.2.9 to right-hand router (using MAC address).

4. Right-hand router broadcasts ARP request for address 1.2.5.2.

5. Top router responds with its MAC address.

6. Right-hand router forwards packet with destination address 1.2.2.9 to top router.

7. Top router broadcasts ARP request for address 1.2.2.9.

8. Host with address 1.2.2.9 responds with its MAC address.

9. Top router forwards packet with destination address 1.2.2.9 to destination host.

What packets must be sent when the server sends a second packet to the same host?

In this case, steps 3, 6 and 9 from the above list are all that’s required.

-7-
CSE 473 – Introduction to Computer Networks Jon Turner
Exam 2 Solutions
11/7/2012

1500 0
100
1400 P A
B 200
O
C
1. (10 points). The diagram at right shows a DHT with 16 1300
nodes. Each node is labeled with the first value in its range N D 300
host firstHash
values (so for example, B is responsible for hash values 1200 K 1000
100-199. The routing table for node J is shown in the figure. M L 1100 E 400
Note that J has routes to the node that is 1 hop away, the N 1300
one that is 2 hops away, the one that is 4 hops away and L B 100 F 500
the one that is 8 hops away. Assume that all nodes have 1100
routing tables that are configured similarly. K G 600
1000 J H
900 I 700
Suppose the client shown in the diagram sends a get
800
request to node H with a key string of “flapjack”, and that
hash(“flapjack”)=513. List the servers through which this
request would pass, assuming that the key string does not client
appear in any node’s cache.

It would go through nodes P, D and F before returning to H and then the client.

What servers would the request pass through if the key string appears in node M’s cache?

The same set.

What servers would it pass through if the key string appears in node D’s cache?

P and D.

Suppose that “flapjack” is requested frequently. Specifically, each DHT node receives a get
request for “flapjack” about once per second. If the system is operated without caches, how
many requests per second must the “responsible server” process?

16 requests per second.

If caching is enabled, and each cache entry expires 60 seconds after being placed in the
cache, approximately how often does the responsible server receive a get request from
another server? (Hint: how many other servers send directly to the “responsible server”?)

There are 4 servers that send packets directly to the responsible server. These 4 servers will each send
the responsible server a new request every 60 seconds, so the responsible server will receive a request
about once every 15 seconds from another server (in addition to the one per second that it receives
directly from clients).

-1-
2. (10 points). Consider a pipelined, reliable transport protocol that uses go-back-N with
cumulative acknowledgments. Assume that timeouts trigger retransmissions (duplicate
ACKs do not) and that the receiver does not maintain any receive buffer. If the one-way
delay between the sender and receiver is 50 ms and every packet is 10,000 bits long, how big
must the window be to allow the sender to send at a steady rate of 1 Gb/s under ideal
conditions?

RTT=.1 second, so a 1 Gb/s link sends 100M bits per RTT or 10K packets per RTT. So the window
size must be at least 10,000 to support a 1 Gb/s rate.

Suppose that approximately one packet in 100,000 is lost. If the sender uses a timeout of 500
ms and a window size of 20,000 packets, how often does sender experience a timeout? How
many packets will it retransmit when a time out occurs?

Assuming that the bottleneck link rate is 1 Gb/s, the sender can still only send 10K packets per RTT.
After each loss, it takes half a second for the sender to detect the loss and all packets sent in that half
second are effectively wasted (since the receiver discards them in go-back-N). But the window size
limits the number of packets sent following the lost packet to 20K. So immediately after each loss, the
sender sends 20K packets, pauses for .3 seconds then re-sends the first 20K packets before sending
another 60K, at which point it loses another packet. So, the sender experiences a timeout every 1.3
seconds.

If we do not assume a 1 Gb/s bottleneck link rate, the sender can send 20K packets per RTT. In this
case, after sending the packet that gets lost, it again times out after half a second, before re-sending
20K packets plus 60K new ones (which takes 400 ms). So, the sender has a timeout every 900 ms.

Assume that after the connection starts at time 0, the 100,000-th packet (call it p) is lost. At
what time was p sent by the sender?

At time 1 second if we assume a 1 G/bs bottleneck link rate, 0.5 seconds if we do not.

At what time does the sender re-transmit p?

1.5 seconds if we assume a 1 Gb/s bottleneck link rate, 1 second if we do not.

What happens to the packets sent between the time p is sent the first time and the time it is
retransmitted?

They are discarded by the receiver and retransmitted by the sender

Estimate the throughput for this connection, assuming one packet in 100,000 is lost.

Assuming a 1 Gb/s bottleneck link rate, the receiver gets 80K new packets every 1.3 seconds, so the
throughput is (8/13) Gb/s which is about 620 Mb/s.

If we do not assume a 1 Gb/s bottleneck link rate, the receiver gets 80K new packets every .9 seconds,
so the throughput is (8/9) Gb/s, which about 890 Mb/s.

-2-
A B
3. (10 points). The diagram at right shows a TCP
segment being sent from host A to host B and an
ACK being returned. The numbers on the arrows 10
are the sequence numbers of the data segments and
the ACK numbers. Suppose that after receiving the
20
ACK with ack number 20, A sends packets with
sequence numbers 20, 30, 40, 50, 60, 70, 80, 90 and 20
100. Some time later, it receives ACKs with
sequence numbers 40, 40, 60, 60, 60, 60, 60. (Assume 30
that A sends no additional data segments in the
meantime.) Complete the diagram in a way that is 40
consistent with the given information and what
50
you know about the way TCP behaves.
60
What sequence number would you expect to see in X
the next packet sent by A? 70
80
60
90
100
What ACK number would you expect in the next
ACK? You may assume that all packets sent by A
carry 10 bytes of data. 40

110
40
60
60
60
60
60

-3-
R1
S1 50 ms
4. (10 points) The diagram at right shows two
TCP senders at left and the corresponding
receivers at right. Both senders use TCP Reno. R2
Assume that the MSS is 1 KB, that the one-way S2 2 Mb/s
propagation delay for both connections is 50 ms
and that the link joining the two routers has a
bandwidth of 2 Mb/s. Let cwnd1 and cwnd2 be the values of the senders’ congestion
windows and assume that cwnd1= cwnd2. What is the smallest value of cwndi for which the
link joining the two routers stays busy all the time?

We need 200 Kbits per RTT to keep the link busy, or 100 Kbits per sender. That means 12.5 KB

Assume that the link buffer overflows whenever cwnd1+cwnd2≥36 KB and that at time 0,
cwnd1=12 KB and cwnd2=24 KB. Approximately, what are the values of cwnd1 and cwnd2 one
RTT later? Assume that all packet losses are detected by a triple duplicate ack.

6 KB and 12 KB

How many RTTs pass before cwnd1+cwnd2=36 again? What are the values of cwnd1 and
cwnd2 at this point?

After 9 more RTTs, we have cwnd1=15 KB and cwnd2=21 KB

Approximately, how many RTTs pass (in total) before cwnd2 – cwnd1 < 2 KB?

After 11 RTTs, the difference is 3 KB and it remains 3 KB for another 9 RTTs when the buffer fills
again, at which point it becomes 1.5 KB. So approximately 21 RTTs pass before the difference in the
congestion windows drops below 2 KB.

-4-
AS4
1.2.4.*

5. (10 points). The diagram below shows several


autonomous systems and for each one, a AS3
prefix that it advertises to other ASs.
AS2
router 1.2.3.*
Assuming that router C has IBGP sessions 1.2.2.* port
to all four gateway routers in AS1, list all the 1.2.2.1 1.2.3.1
path vectors that it would receive describing paths to
to other ASs. For each path vector identify the AS1
gateway router from which C receives the path A 10 B
6 3 9
vector, the vector itself, and the associated next- 1
hop address. 7 C 11
2 5 link cost

A AS2 1.2.2.1 D 8 E
prefix
prefix output
output
A AS2, AS4 1.2.2.1 1.2.2.*
1.2.2.* 3
1.2.5.2 1.2.5.1 1.2.3.*
A AS2, AS4, AS3 1.2.2.1
1.2.3.* 1
AS5 1.2.4.*
1.2.5.*
1.2.4.* 3
B AS3 1.2.3.1 1.2.5.*
1.2.5.* 2
B AS3, AS4 1.2.3.1

B AS3, AS4, AS2 1.2.3.1

D AS5 1.2.5.2

E AS5 1.2.5.1

The table at the bottom right of the figure represents a portion of the routing table at C.
Complete the table, as it would be completed, assuming that AS1 uses OSPF in addition to
BGP. For this part assume there are no policy constraints.

Suppose that AS1 is not intended to carry transit traffic. Explain how AS1 can use BGP to
enable it to receive traffic from other ASs, while not allowing them to send traffic through it.

It advertises its own prefixes, but does not advertise prefixes belonging to other ASs.

-5-
internal external internal external
(IP,Port) port E (IP,Port) port
10.1.1.1,7654 6789 4.3.2.1 10.1.1.4,80 80
6. (10 points). The figure at right shows 10.1.1.2, 2345 3456
two residential networks with routers
that implement NAT. Suppose host A is
connected to the web server at host E. 1.2.3.4 5.6.7.8
NATs
In the left-hand NAT table, add an entry
that would allow A to communicate A B C D
with E. You may choose any port
numbers you like. 10.1.1.1 10.1.1.2 10.1.1.3 10.1.1.4

Show the values of the address and port fields in the diagram below, for a typical packet
sent by host A.

src adr dest adr src port dest port


10.1.1.1 4.3.2.1 7654 80

Show the fields in the packet as it might appear when it reaches E.

src adr dest adr src port dest port


1.2.3.4 4.3.2.1 6789 80

Suppose the user in the right-hand network wants to run a web server on host D. Add an
entry to the right-hand table that would allow remote connections to the web server.
Assume host B connects to the web server at D. Add an entry to the left-hand NAT table for
this connection. Show the address and port field for a typical packet leaving host B, the
fields in the same packet as it passes through the public internet, and the packet that is
delivered to D.

src adr dest adr src port dest port


10.1.1.2 5.6.7.8 2345 80

src adr dest adr src port dest port


1.2.3.4 5.6.7.8 3456 80

src adr dest adr src port dest port


1.2.3.4 10.1.1.4 3456 80

-6-
address port
7. (10 points) The diagram at right shows a w
switched Ethernet LAN. Assume that the A 3
routing tables are empty initially. Show the 1 B 2
contents of the routing table at switch v, after host u v
A sends a packet to host B and host B sends a 3
2
response. You may assume that A and B denote the
MAC addresses of the corresponding hosts x z
Suppose that at this point, a host at switch w sends A B
a packet to some host other than B at switch z.
y
Which switches in the network receive a copy of
this packet?

All of them: u, v, w, x, y, z

If a host at switch y sends a packet to host A, which switches receive a copy?

u, v, x, y

The figure at right represents a switched Ethernet network, w


where the letters represent the switch identifiers and the 2 8
9
numbers on the links represent costs used by the spanning tree
u 5
algorithm. Assume that the switch identifiers are ordered v z
alphabetically (so x comes before y, for example) and that all
6 3
switches begin execution of the spanning tree algorithm at the 4
same time and that all of them send an initial message to their 7
neighbors, then receive the messages sent by their neighbors. x y

At this point, each switch has a tentative candidate for the spanning tree root. Complete the
table below to show the candidate root for each switch.

u v w x y z
u v u u x v

In the diagram, highlight the edges that are included in the spanning tree when the
algorithm completes (make the tree edges “heavier” by drawing a thicker line).

Suppose that all the links in the network operate at 1 Gb/s. Suppose we have a TCP
connection between hosts on switches v and w, another between hosts on switches y and z
and a third between hosts on switches u and x. If all hosts are trying to send data as fast as
they can, what throughput would you expect each to achieve?

They would each get 333 Mb/s, since all three share the link from u to x.

What throughput could they achieve if the routing was not limited to the spanning tree?

They could each get 1 Gb/s if they used the directly connecting links.

-7-
CSE 473 – Introduction to Computer Networks Jon Turner
Final Exam Solution

1. (8 points). The figure below shows a network path connecting a server to a client.

200 km 2000 km 2 km
X Y
1 Gb/s 1 Gb/s 1 Mb/s

What is the propagation delay for a packet going from the server to the client (you may
assume that the speed of light is 200,000 km/s)?

1 ms + 10 ms + .01 ms = 11.01 ms

What is the total transmission delay of a 10,000 bit packet on all of the links?

10 µs + 10 µs + 10 ms = 10.02 ms

What is the average queueing delay at router X, assuming that the traffic intensity is 1.3, and
the buffer can hold 10,000 packets and that the average packet size is 5,000 bits?

In this case, the queue will be nearly full all the time, so it takes about 10,000*5,000 ns or 50 ms for a
packet to get to the front of the queue.

What is the average queueing delay at router Y, assuming that the traffic intensity is 0.8, and
the buffer can old 100 packets and the average packet size is 5,000 bits?

In this case, the average number of packets in the queue is 0.8/(1–0.8)=4, so the queueing delay is
4*5,000 µs or 20 ms.

-1-
2. (15 points) The diagram at right shows two R1
TCP senders at left and the corresponding S1 100 ms
receivers at right. Both senders use TCP Tahoe.
Assume that the MSS is 1 KB, that the one-way
R2
propagation delay for both connections is 100 S2 4 Mb/s
ms and that the link joining the two routers has
a bandwidth of 4 Mb/s. Let cwnd1 and cwnd2 be
the values of the senders’ congestion windows and assume that cwnd1= cwnd2. What is the
smallest value of cwndi for which the link joining the two routers stays busy all the time?

The RTT is 200 ms in this case, so the link rate is equivalent to 800 Kb per RTT or 100 KB.
So, cwnd1=cwnd2= 50 KB.

Assume that the link buffer overflows whenever cwnd1+cwnd2≥200 KB and that at time 0,
cwnd1=40 KB and cwnd2=160 KB. Approximately, what are the values of cwnd1 and cwnd2 one
RTT later? Also, what are the values of ssthresh for each of the two connections? Assume
that all losses are detected by triple duplicate ACKs.

Since we are using Tahoe, we go to slow start in this case. So, cwnd1=cwnd2= 1 KB, ssthresh1=20 KB
and sshresh2= 80 KB.

After 7 more RTTs, approximately what are the values of cwnd1 and cwnd2?

22 KB and 80 KB

Approximately, how many more RTTs before cwnd1+cwnd2≥200 KB again?


What is cwnd2–cwnd1 at this point?

(200–102)/2=49 RTTs cwnd2–cwnd1=58 KB

Approximately, how many more RTTs pass before cwnd1+cwnd2≥200 KB and


cwnd2–cwnd1≤10 KB?

The difference goes down by roughly a factor of 2 after every cycle of the congestion control algorithm.
So, 3 more cycles will be required to get the difference below 10 KB.
So it will take about 3*(1+7+49)=171 RTTs.

-2-
3. (10 points) The figure below shows a portion of the internet with four autonomous systems,
one of which is shown with four routers, each with its own /16 subnet. Note that each of the
other ASs has a /8 subnet. The blank routing table at right is for router C. Complete the
table, providing an entry for each of the seven subnets. Assume that AS1 uses OSPF as its
intra-AS routing algorithm, and BGP as its inter-AS routing algorithm. Use the standard tie-
breaking rules and assume there are no policy constraints that must be satisfied.

AS4
4.*
output
prefix link

AS2 AS3 1.1.* 1


2.* 3.* 1.2.* 2
1.3.* 3
1.4.* 2
1.1.* A 4 B 1.2.*
2.* 1
13 AS1 5 3.* 2
1 4.* 2
3 2 1.4.*
1.3.* C 7 D

Suppose the link joining router B with AS3 fails, which entries would change, and how
would they change?

The output link fields of the last two entries would both change to 1.

-3-
4. (8 points) Consider a VoIP system that uses a fixed playout delay of 200 ms. If a receiver
receives a sequence of four packets with timestamps 17.02, 17.04, 17.06 and 17.08 (where the
timestamp is expressed in seconds relative to some arbitrary starting time), when will the
receiver play out these packets (you may assume that the receiver’s clock is synchronized
with the sender’s).

At times 17.22, 17.24, 17.26 and 17.28.

Now, suppose that we are using an adaptive playout delay, instead of a fixed playout delay.
After a period of silence, the receiver starts receiving a sequence of voice packets with
timestamps 30.01, 30.03, 30.05 and 30.07. Let di=50 ms be the current value for the average
measured delay across the network, let vi=5 ms be the current value of the measured delay
variation. When computing the playout time, multiply the delay variation by the parameter
K=5. At what times are the four packets played out?

The playout delay is 50+25=75 ms, so the playout times are 30.085, 30.105, 30.125 and 30.145.

Now suppose the VoIP system does loss concealment by separating “odd” voice samples
from “even” voice samples and sending them in different packets. In this scheme, samples
from missing packets can be interpolated using the samples from the previous and
following packets. How does this affect the required playout delay if voice packets are still
sent at the rate of 50 packets per second, during a talkspurt?

To compute the samples from a lost packet, we need to wait for the next packet to arrive. This
effectively increases maximum delay that packets can experience, adding 20 ms to the playout delay.

-4-
5. (10 points) Consider a token bucket rate controller, used to control a reserved rate flow.
Assume that the token bucket has a capacity of 10 tokens and a token fill rate of 100 tokens
per second, and that every packet consumes one token. If no token is available for an
arriving packet, it is marked for possible discarding.

Suppose that at time 0, the token bucket is empty and the next token “arrives” at time 10 ms.
If packets arrive at times 11, 13, 17, 19, 23 and 29, which packets (if any) are marked. (You
may identify the marked packets by their arrival times.)

Packets 13, 17, 19 and 29 will all be marked.

How many tokens are in the token bucket at time 55 ms if no additional packets arrive?

Tokens are added to the bucket at times 30, 40 and 50, so the token bucket will have 3 tokens at time
55.

How many tokens are in the token bucket at time 195 ms?

10.

What is the largest number of packets that can be sent between time 201 ms and time 299 ms
without any of the packets being marked?

We get at most 9 new tokens during this period so at most 19 packets can be sent without being
marked.

If this largest possible number is sent between times 201 and 299, what is the largest number
of packets that can be sent between times 301 ms and 399 without any of the packets being
marked?

New tokens are added 300, 310,..., 390, so 10 more can be sent without being marked.

-5-
6. (12 points) Consider a user who is downloading a large file from a remote web server to her
laptop in a coffee shop with WIFI access. The shop’s DSL link has a download rate of 5
Mb/s and the wireless network supports a peak rate of 50 Mb/s. Assume there are no other
limits on the user’s download rate (no one else in the coffee shop is online and the server
and internet path are lightly loaded).

What is the maximum throughput the user can expect in this case?

5 Mb/s

Approximately how often does TCP have to retransmit a packet in this scenario? Assume
that the maximum segment size is 10,000 bits and that the round-trip time is 122 ms.

To answer this, we first need to compute the loss probability for the TCP connection.

L=((1.22*10,000)/(.122*5,000,000))2=(1/50)2=.022=.0004

so TCP must retransmit approximately one packet in 2500 and since it will send an average of 500
packets per second, this translates to one packet every 5 seconds.

Now, assume that the wireless network experiences interference whenever the coffee
grinder is running. During this time, it fails to deliver approximately 4% of the packets sent
to the user. Approximately what throughput can you expect in this situation?

This loss rate is 100 times larger than the loss rate in the first scenario, and since the throughput is
inversely proportional to the square root of the loss rate, we expect the throughput to go down by a
factor of 10 to 500 Kb/s. Or, we can apply the throughput equation directly.

T=(1.22*10,000)/(.122*sqrt(.04))=100,000/.2=500 Kb/s

Suppose the throughput went down by a factor of 2, relative to the previous situation.
Approximately what would the packet loss rate have to be, in order to explain this?

Since loss rate is inversely proportional to the square of the throughput, the loss rate must have gone
up by factor of 4 to 16%.

-6-
7. (10 points) The diagram at right shows a WIFI network with an A X B
access point, X and three hosts, A, B and C. The large circles
indicate the coverage areas of the three hosts. The coverage area C
for X is not shown, but you may assume that it includes all three
hosts. Assume RTS/CTS are not used.

Suppose X is transmitting a packet at time 0 and finishes sending it at time 100 µs. Also,
• A gets a packet to send at time 50 that takes 100 µs to send and is assigned a backoff timer
of 70.
• B gets a packet at time 70 that takes 200 µs and is assigned a backoff timer of 200.
• C gets a packet at time 120 that takes 150 µs and is assigned a backoff timer of 150.
For each of the three hosts, what time do they start sending their packets? You may ignore
the inter-frame spacing and the time required for acks.

A starts sending at time 170


B starts sending at time 300
C defers while A is sending, so it starts at time 120+100+150=370

Of the three packets sent, which are successfully delivered on the first attempt?

Only the packet from A is delivered.

For each packet that is not successfully delivered on the first attempt, approximately when
does the sending host learn that the packet was lost and must be sent again?

Hosts learn of lost packets from the absence of ACKs. Here, B would expect an ACK at 500 and so
would learn of the lost packet when the ACK fails to arrive at time 500. Similarly, C would learn of
its lost packet at time 370+150=520.

Now, suppose RTS/CTS is enabled. In this case, approximately when does each host send
its data packet? You may assume that the time needed to send RTS, CTS and ACK packets is
negligible.

A sends at 170.
B sends at 550.
C sends at 370.

-7-
8. (10 points) Recall that an RSA encryption key is a pair of numbers (n,e) and the
corresponding decryption key is another pair (n,d). Which of the following could be used as
RSA key pairs (ignoring the fact that they are too small)? For those that are valid key pairs,
show that they meet all the requirements for a key pair, for those that are not, explain why
they are not.

• (31,5), (31,11)

This is not a valid key pair as n=31 is a prime, and for a valid pair, it must be the product of two
primes.

• (77,7), (77,43)

n=pq, where p=7, q=11, (p–1)(q–1)=60, 7 and 60 are relatively prime and (ed–1)=300 is a
multiple of 60, so this is a valid key pair.

• (55,7), (55,41)

This is not a valid key pair, since (p–1)(q–1)=50 and (ed–1)=286 is not a multiple of 50.

Consider the pair (91,5), (91,29). Assume the first is the encryption key and the second is the
decryption key. What is the encrypted value of the number 10? (Hint: 102 mod 91=9)

(102 mod 91)= 9, so (104 mod 91)= 81 and (105 mod 91)=(810 mod 91)=810–8*91=810–728=82

-8-
9. (10 points) The diagram below represents a portion of the payload of an IP datagram
carrying data for an SSL session. Each line represents a distinct SSL record.

type version length data MAC


0 3.2 35 kasfjla;kja;ljf 2343
0 3.2 41 aiusrooqirgn/nc;p 9783
0 3.2 25 qp98hj;vn 8520
1 3.2 36 z2jt3;r’wjf2h5 2985

Which of the fields in each record are encrypted by the sender, and which are sent as
cleartext.

The type, version and length field are sent as clear text, while the data and MAC are encrypted.

Suppose an attacker was able to intercept and modify packets as they pass through the
internet. If the attacker were to modify several bytes in the data field of the second record,
what changes would the attacker have to make to the IP and TCP headers, in order to
ensure that these records were actually delivered to the SSL software.

It would have to recompute the IP and TCP checksums.

How would the SSL software detect the modification to the second record?

The MAC for record 2 would not match the one computed for the modified record.

Suppose the attacker were to make a copy of the second record and insert it after the third
record (so the modified packet had five records). Explain how the SSL software at the
receiver would detect this modification?

The computed MAC at the receiver would not match for this record, since it uses a different sequence
number that the sender did for this record.

Suppose the attacker were able to discover the key used for the MAC, but not the encryption
key. Could the attacker use this to change the type field of the third record, without it being
detected by the SSL software at the receiver. If so, explain how this is done. If not, explain
why not.

This could not be done, because the MAC field must be encrypted. So, even if the intruder could
compute a new MAC field, it could not produce the encrypted version. Actually, since the MAC is
computed over the unecrypted record, the attacker could not even compute the required MAC value,
let alone encrypt it.

-9-
CSE 473 – Introduction to Computer Networks Jon Turner
Exam 1 Solution
9/26/2013

1. (10 points). A user in Chicago, connected to the internet via a 100 Mb/s (b=bits) connection
retrieves a 250 KB (B=bytes) web page from a server in London, where the page references
three images of 500 KB each. Assume that the one way propagation delay is 75 ms and that
the user’s access link is the bandwidth bottleneck for this connection.

Approximately how long does it take for the page (including images) to appear on the user’s
screen, assuming non-persistent HTTP using a single connection at a time (for this part, you
should ignore queueing delay and transmission delays at other links in the network)?

4*(300) ms + (2 + 3*4 Mb)/(100 Mb/s) = 1200 ms + 140 ms = 1.34 seconds

How long does it take if the connection uses persistent HTTP (single connection)?

3*150 ms + 140 ms = 590 ms

Suppose that user’s access router has a 4 MB buffer (B=byte) on the link from the router to
the user. How much delay does this buffer add during periods when the buffer is full?

A 4 MB buffer is 32 Mbits, so it adds 320 ms to the delay on a 100 Mb/s link.

-1-
2. (10 points). The diagram below shows a network with 3 routers (shown as hexagons)
connected by an Ethernet switch. The routing table for the left-hand router is shown.
Complete the routing table for the right-hand router, so that packets will be delivered
appropriately (use no more than 5 route table entries).

1.2.2.10 1.2.2.18

1.2.2.9 1 2 1.2.2.17
3
1.2.3.45 1.2.5.2
1.2.1.10
1.2.3.46 1.2.1.9
1 2
2 1
3 1.2.5.4 1.2.5.1 3
1.2.3.10 1.2.1.29

1.2.3.9 1.2.1.30
1.2.5.3
next hop next hop
prefix output ip
1.2.2.8/30 2 1.2.5.2 prefix output ip
1.2.1.0/26 2 1.2.5.1 1.2.2.0/26 1 1.2.5.2
1.2.5.0/24 2 -
1.2.2.16/30 2 1.2.5.2
1.2.3.0/26 1 1.2.5.4
1.2.3.44/30 1 - 1.2.5.0/24 1 -
1.2.3.8/30 3 -
1.2.1.28/30 3 -
1.2.1.8/30 2 -

Are all the entries in the left-hand router’s table necessary? If not, show how to reduce the
number of entries, without changing the routing behavior.

The two entries for subnets 1.2.2.8/30 and 1.2.2.16/30 could be replaced with a single entry that maps
prefix 1.2.2.0/27 to next hop 2:1.2.5.2.

Suppose we wanted to add a switch at port 1 of the left-hand router, along with 10 new
hosts (the existing host would now be connected to the switch, rather than the router).
Which routing table entries would have to change as a result? What are the new entries?

The subnet at port 1 of the left-hand router is currently configured as a /30. After adding the switch,
this subnet will require at least 12 IP addresses. This implies that it needs to be at least a /28 subnet.
So, the route with prefix 1.2.3.44/30 at the left-hand router should be changed to 1.2.3.32/28.

-2-
3. (5 points). The diagram below shows the bytes that define a 16 bit integer and a 32 bit
integer as they are stored in a computer’s memory. Assume that the computer is big-endian
and that the values are shown as the computer would normally store them.

When these bytes are sent to a remote computer over ...


the internet, in what order would the bytes be sent?
x13a cc
The bytes would be sent cc, dd, 33, 44, 55, 66. 16 bit value
x13b dd
Is the 16 bit value odd or even? x13c 33

Since the low order byte is dd, it is odd. x13d 44


32 bit value
x13e 55
Suppose the bytes are delivered to a computer that is
little-endian. Is it necessary for the remote computer to x13f 66
swap the bytes?
...
yes

Assume the diagram below shows the portion of remote computer’s buffer where these
bytes are stored. Show how the bytes would appear in the remote computer’s after any
required byte-swapping is done. If none is required, write the byte values as they are
delivered.

...

x252 dd

x253 cc

x254 66

x255 55

x256 44

x257 33

...

-3-
4. (15 points) Consider a router with links of 1 Gbs and a single queue at each output that can
hold 5000 packets. Suppose traffic from five flows is being sent out on one of its links.
Assume the packets in these flows are 10,000 bits long. Four of the flows (the “small flows”)
are sending 10 thousand packets per second, and the fifth one (the “large flow”) is sending
50 thousand packets per second. What is the average number of packets in the queue? Is it
likely that packets will get discarded in this situation?

The link can forward 100 Kp/s. Since the arriving packet rate is 90 Kp/s, the traffic intensity is 0.9, so
the average number of packets in the queue is .9/(1-.9)=9.

No packet losses are likely to occur in this case.

Now, suppose the large flow increases its sending rate to 80 thousand packets per second.
What is the rate at which the large flow’s packets are sent over the link?

The arriving packet rate is now 120 Kp/s, so the traffic intensity is 1.2. So only 5/6 of the arriving
traffic can be sent on the link. So the large flow is able to send 80*5/6 or about 66.7 Kp/s.

What is the rate at which one of the slow flow’s traffic leaves the queue?

10*5/6 or about 8.3 Kp/s

Suppose the router is equipped with 5 queues that can hold 1,000 packets each, and that are
serviced in round-robin order, with each flow assigned to a separate queue. In this case,
what is the output rate for the large flow?

In this case, only the large flow will experience loss, so the 20 Kp/s of excess traffic is all taken from
the large flow. Hence, its output rate is 60 Kp/s.

Approximately what is the delay experienced by packets in the large flow (those that are not
discarded)?

Since the small flows use 40% of the link’s capacity, the large flow sends a packet every 10/0.6
microseconds. This is 16.7 microseconds, so the total queueing delay is 16.7 ms.

-4-
5. (10 points) Consider a classical 10 Mbs Ethernet. Suppose we require that the network
operate at an efficiency of at least 80% when all packets have minimum length (ignore the
preamble and flag, when making this calculation). Approximately what is the largest
propagation delay that is consistent with this requirement?

(Ttrans/Tprop )/(5+(Ttrans/Tprop)=0.8 implies (Ttrans/Tprop)=20

A minimum length packet is 64 bytes, which is 512 bits. So Ttrans is about 50 µs, this implies Tprop can
be at most 2.5 us.

What is the maximum distance across the network, assuming signals travel at a speed of
200,000 km/s?

The max distance is 500 meters.

What is the maximum distance if the Ethernet speed increases to 100 Mb/s?

50 meters.

Consider a 100 Mb/s ethernet with a maximum distance of 400 meters. What is the smallest
packet length for which you can achieve an efficiency of 80%?

8 times the minimum length, so 512 bytes.

-5-
6. (10 points) The diagram below shows two subnets connected by a router. For each host and
router port, the IP address and MAC address (abbreviated) are shown. Initially the ARP
tables of the hosts and router are empty. Suppose A sends a packet to B. Show the contents
of the ARP tables after the packet reaches B.

IP MAC
5.4.3.7 77:...:77
IP MAC
1.2.3.1 aa:...:aa

5.4.3.2
B bb:...:bb
1.2.3.4
5.4.3.7
44:...:44
77:...:77
1.2.3.1
A IP MAC
aa:...:aa
5.4.3.2 bb:...:bb
IP MAC
1.2.3.4 44:...:44

Assuming that each of the switched subnets has 100 desktop client computers and one
server machine, approximately how many ARP table entries would host A typically have.

Two, one for the router, and one for the server.

How many would the router have?

Close to 200, since it could be communicating with all the hosts in both networks.

Suppose there is a server connected to the router by a point-to-point link and no other
network connection. How many ARP table entries would it require?

Just one.

-6-
7. (15 points). The diagram below shows two residential networks with routers that implement
NAT and a remote server with a public internet address

internal external internal external


(IP,Port) port E (IP,Port) port
10.1.1.1,5555 8888 4.3.2.1 10.1.1.4,1212 5454
10.1.1.2,6565 7878

NATs

A B C D

10.1.1.1 10.1.1.2 10.1.1.3 10.1.1.4

The packet header diagrams at right are for a


src adr dest adr src port dest port
packet from a host in the left-hand network, going
to the server. The first shows the header when the 10.1.1.1 4.3.2.1 5555 3333
packet arrives at the router, the second shows it
when the packet leaves the router. Add an entry to 3.7.5.7 4.3.2.1 8888 3333
the left-hand NAT table that is consistent with
these two packet headers. What is the public IP address of the left-hand router?

3.7.5.7
src adr dest adr src port dest port
The three header diagrams at right are for a packet
from a host in the right-hand network, going to a 10.1.1.4 3.7.5.7 1212 7878
host in the left-hand network. Fill in the blank
fields. Add entries to the two NAT tables that are 5.3.5.2 3.7.5.7 5454 7878
consistent with this sequence of packet headers.
What is the public IP address of the right-hand
5.3.5.2 10.1.1.2 5454 6565
router?

5.3.5.2

In the diagrams at right, fill in the src adr dest adr src port dest port
header fields that would be used by a
response to the last packet, (the
10.1.1.2 5.3.5.2 6565 5454
response goes from the right hand
network to the left).
3.7.5.7 5.3.5.2 7878 5454

3.7.5.7 10.1.1.4 7878 1212

-7-
CSE 473 – Introduction to Computer Networks Jon Turner
Exam 2 Solutions
Your name: 10/31/2013

1. (10 points). Consider a circular DHT with 27 nodes numbered 0, 1,...,26, where the nodes
cache key-values pairs for 60 seconds before discarding them. Assume that each node i
handles keys with hash values in the range 100i to 100i+99. Also, assume that node i has
routes to nodes i+1, i+3 and i+9 (where the additions are modulo 27). What is the maximum
number of hops required to get from one server to another in this DHT?

Each step moves you closer to the target by 1, 3 or 9 hops. Since 26=9+9+3+3+1+1, the maximum
number of hops is 6.

Suppose that some client sends a get request to node 20 with a key string of “candy corn”,
and that hash(“candy corn”)=1853. If the request is handled by exactly 4 nodes in the DHT
(including 20), which nodes are they?

20+9=2 (mod 27), 2+9=11, 11+3=14. So, the four nodes are 20, 2, 11 and 14.

Suppose node 13 has an entry for “candy corn” in its cache but no other nodes do. Now
assume that every other node receives a get request for “candy corn”. How many of these
requests does 13 handle? (Ignore any new cache entries that might be created in the process
of handling these requests.)

Node 13 will handle the request if it first arrived at node 13, 10, 4, 1, 22 or 19. So, node 15 will
handle 5 requests from other nodes, plus one more if you include a request sent to 15.

Repeat your answer to the last question assuming that node 2 has the cached entry for
“candy corn”. (That is, how many of the requests would 2 handle in this case?)

Node 2 would only handle requests that arrive at node 2 or node 20. So 1 request from other nodes,
plus the one sent to 2.

-1-
2. (10 points) The diagram below shows a DNS query from a host A to its local DNS server.
The IP addresses of all hosts are shown in the diagram. The label “Q(web.foo.edu)” specifies
the query string. Complete the diagram showing all packets sent to resolve the name and
continuing through the opening of a TCP connection to the web site and the first GET
request. All arrows that represent DNS queries should have a label of the form “Q(a.b.edu)”
and replies should have a label of the form “R(b.edu=2.3.7.11)”. TCP connection packets
should be labeled with the appropriate flags and HTTP packets with the request type.
Assume that the local DNS server performs recursive processing and has nothing in its
cache, while the others perform iterative processing. You may assume that all queries and
responses are for A records.

local DNS root DNS .edu DNS foo.edu DNS web.foo.edu


A 5.4.3.2 4.3.2.1 1.2.3.4 2.3.4.5 2.3.4.13

Q(web.foo.edu)
Q(web.foo.edu)

R(.edu=1.2.3.4)
Q(web.foo.edu)

R(foo.edu=2.3.4.5)
Q(web.foo.edu)

R(web.foo.edu=2.3.4.13)
R(web.foo.edu=2.3.4.13)

SYN
SYN+ACK

GET

List all the mappings in the local DNS server’s cache after the query has been processed.

.edu=>1.2.3.4, foo.edu=>2.3.4.5, web.foo.edu=>2.3.4.13

List the mappings in the local server’s cache if the .edu server did recursive processing rather
than iterative.

.edu=>1.2.3.4, web.foo.edu=>2.3.4.13

-2-
3. (10 points) The diagram at left below shows the state of the sending side of a
communication session using a go-back-N protocol with cumulative acknowledgements, a
window size of 4 and a retransmission timeout of 25. The array represents the “re-send”
buffer and each pair in the buffer represents a packet and its sequence number, together
with the time at which it is scheduled to be retransmitted (so, for example, the pair (p3,14)
denotes a packet with sequence number 3, which is to be retransmitted at time 14). Assume
that the channel may lose packets but never re-orders them and that one way network delay
is always at least 5 time units.

0 0

1 1

sendBase=2 2 p2 sendBase=4 2

3 p3 3
timerExpiresAt=35 4 p4
4 p4

nextSeqNum=5 5 nextSeqNum=6 5 p5

6 6

time=6 7 7

Suppose that at time 7, the application passes us a new payload to be sent and at time 12, we
receive an ack with sequence number 3.

List all the packets sent by the sender between times 6 and 13, including repeats (if any).

p5, p2, p3, p4, p5

Show the state of the sender at time 13, in the right-hand diagram.

At time 12, how many additional packets can be sent before an ack is received?

-3-
4. (10 points) Consider a TCP sender that sends 10 bytes A B
per packet. Suppose that the sender transmits six 10
packets one right after another (including the one 20
shown at right). Show the packets and the
corresponding acks that TCP would return in a typical 30
situation. Label the data packets with the sequence
number and the ack packets with the ack number. 40
If the second of the acks is lost, will the sender 50
retransmit any packets? Why or why not? 30
60
No, because the next cumulative ack lets the sender know
that the corresponding packet was delivered. 50
Continuing the example, suppose that the next two
packets sent arrive out of order and that the sender
transmits four more packets after these and that the 70
second packet in this group of four is lost. Extend the
diagram to show these packets and the resulting
70
acknowledgements. You need not show the 80
retransmission of the lost packet.
70
90

90
100
110
120

100

100

-4-
5. (10 points) The diagram at right shows two TCP R1
senders at left and the corresponding receivers at S1 100 ms
right. Both senders use TCP Tahoe. Assume that
the MSS is 1 KB, that the one-way propagation
R2
delay for both connections is 100 ms and that the S2 16 Mb/s
link joining the two routers has a bandwidth of 16
Mb/s. Let cwnd1 and cwnd2 be the values of the
senders’ congestion windows. What is the smallest value of cwnd1+cwnd2 for which the link
joining the two routers stays busy all the time?

16 Mb/s is 2 MB/s or 400 KB per RTT. So cwnd1+cwnd2 =400 KB is the smallest amount that keeps
the link busy.

Assume that the link buffer overflows whenever cwnd1+cwnd2≥600 KB and that at time 0,
cwnd1=500 KB and cwnd2=100 KB. Approximately, what are the values of cwnd1 and cwnd2
one RTT later? Assume that all losses are detected by triple duplicate ACKs.

they are both 1 KB

At this point, what are the values of ssthresh1 and ssthresh2?

ssthresh1=250 KB and ssthresh2=50 KB

After 20 more RTTs, approximately what are the values of cwnd1 and cwnd2?

After 8 RTTs cwnd1 is about 250 KB, so after 20, it is about 262 KB. After 6 RTTs cwnd2 is about 50
KB, so after 20, it is about 64 KB.

Approximately, how many more RTTs before cwnd1+cwnd2≥600 KB again?

262+64=326, so it will take (600–326)/2 = 274/2 = 137 RTTs before cwnd1+cwnd2≥600 KB again.

-5-
6. (10 points). Let A be a router with neighbors B, C and D next hop
prefix output hop count
in a network that uses RIP. The table at right shows the
routing table at A, including the hop-count information 1.2.1.* 1 - 1
used by RIP. 1.2.2.* 2 B 2
1.2.3.* 2 B 3
Based on this information, how many links does a packet 1.2.4.* 3 C 2
need to pass through on its way from A to a host with 1.2.5.* 3 C 3
address 1.2.5.37? 1.2.6.* 3 C 4
1.2.7.* 4 D 2
3 hops 1.2.8.* 4 D 3

Assume that the network has been stable for a long time. Let h be the hop count for the path
from router D to a host in subnet 1.2.6.*. Is it possible that h=2? Why or why not?

No. If D could reach a host in 1.2.6.* in 2 hops, then A could reach it in 3 hops by going through D.
But the table shows that the best path from A has length 4 and goes through C.

Is it possible that h=8? Why or why not?

No. Since D is A’s neighbor, D can be at most 5 hops away from a host in 1.2.6.*.

Suppose that A sends a RIP packet to C. List all the prefixes that A advertises in this packet
(remember that RIP uses poisoned reverse). Show the hop count sent by A for each
advertised prefix.

(1.2.1.*,1), (1.2.2.*,2), (1.2.3.*,3),


(1.2.4.*,15=∞), (1.2.5.*,15=∞), (1.2.6.*, 15=∞),
(1.2.7.*,2), (1.2.8.*,3)

-6-
A
7. (10 points) The diagram at right shows a
1.0.0.3
switched Ethernet LAN with two routers (labeled
Q and R), seven switches and five hosts. The R
w
switches are configured with three VLANs and Q 1
1 1.0.0.2
the labels on the links show the VLANs that are 1.0.0.1 3.0.0.1
active on those links (note, some links are active 2.0.0.1 z
u 1,2
in multiple VLANs). 1,3

v C t
Each VLAN is assigned an IP subnet, specifically, 1,2
VLAN 1 is assigned subnet 1.0.0.0/8, VLAN 2 is 2 2.0.0.3
3 3
assigned subnet 2.0.0.0/8 and VLAN 3 is D
2
assigned subnet 3.0.0.0/8. The two routers each x y
1.0.0.4
belong to two subnets and can send/receive
packets using two VLAN ids, while each of the
B E
hosts is configured in the VLAN that corresponds
to its IP subnet. 2.0.0.2 3.0.0.2

If host B sends a packet to host C, what switches and routers does the packet pass through?
List them in order, repeating any switches that the packet passes through more than once.

x and v

If host A sends a packet to host B, what switches and routers does it pass through.

w, u, Q, u, x

If B sends a packet to E, what switches and routers does it pass through.

x, u, Q, u, w, z, R, z, t, y

If C is transferring a large file to E while B is transferring a large file to D, what data rate
would they each get, assuming that the switch links are all 1 Gb/s?

Because they have some links in common, they would each get 500 Mb/s

What bandwidth would they get if E were in subnet 2.0.0.0/8?

In that case, they would each get 1 Gb/s

-7-
CSE 473 – Introduction to Computer Networks Jon Turner
Final Exam Solution
12/18/2013

1. (10 points). What is the queueing delay at a network link with a link rate of 100 Mb/s, an
arriving traffic rate of 9,000 packets per second an average packet length of 1250 bytes and a
queue length of 500 packets?

The traffic intensity is 0.9, so the average number of packets in the queue is 9. Since the time needed
to send one packet is 100 µs, the average queueing delay is 900 µs.

What is the delay if the arriving traffic rate increases to 15,000 packets per second?

In this case, the queue fills, so the average delay is about 50 ms.

Consider an audio application that sends audio data using RTP and UDP over an Ethernet
network. How many overhead bytes does each packet include, assuming that the RTP
header is 12 bytes? You may ignore the Ethernet preamble and flag.

The overhead is 18+20+8+12=58 bytes.

If audio is encoded at 32 Kb/s and we want or audio packets to be large enough so that the
overhead is at most 20% of the total, how many audio bytes must each packet carry?

We need four times 58 or 232 bytes.

How long does it take to acquire the audio data needed to “fill” a packet?

At 32 Kb/s, we get four bytes of audio data per ms, so it takes 58 ms to fill the packet.

-1-
2. (15 points) The diagram at right shows two TCP senders at R1
S1 50 ms
left and the corresponding receivers at right. The first
sender uses TCP Tahoe, the second uses Reno. Assume that
the MSS is 1 KB, that the one-way propagation delay for S2
R2
6 Mb/s
both connections is 50 ms and that the link joining the two
routers has a bandwidth of 6 Mb/s. Let cwnd1 and cwnd2 be
the values of the senders’ congestion windows. What is the smallest value of cwnd1+ cwnd2
for which the link joining the two routers stays busy all the time?

The RTT is 100 ms in this case, so the link rate is equivalent to 600 Kb per RTT or 75 KB.
So, cwnd1+cwnd2= 75 KB.

Assume that the link buffer overflows whenever cwnd1+cwnd2≥150 KB and that at time 0,
cwnd1=30 KB and cwnd2=120 KB. Approximately, what are the values of cwnd1 and cwnd2 one
RTT later? Also, what are the values of ssthresh for each of the two connections? Assume that
all losses are detected by triple duplicate ACKs.

Since the first uses Tahoe and the second uses Reno, cwnd1=1 KB and cwnd2= 60 KB, ssthresh1=15
KB and sshresh2= 60 KB.

After 8 more RTTs, approximately what are the values of cwnd1 and cwnd2?

19 KB and 68 KB

Approximately, how many more RTTs before cwnd1+cwnd2≥150 KB again?


What is cwnd2–cwnd1 at this point?

(150–87)/2=31.5 RTTs cwnd2–cwnd1=49 KB

Approximately, how many more RTTs pass before cwnd1+cwnd2≥150 KB and


cwnd2–cwnd1≤20 KB?

The difference goes down by a little less than a factor of 2 after every cycle of the congestion control
algorithm. So, 2 more cycles will be required to get the difference below 10 KB.
So it will take about 2*(1+8+31.5)=81 RTTs.

-2-
internal external E internal external
3. (10 points). The figure at right shows two (IP,Port) port (IP,Port) port
residential networks with routers that 10.1.1.5,1111 2222 4.3.2.1 10.1.1.7,4444 5555
10.1.1.3,7777 3333
implement NAT. Suppose host A is
connected to the web server at host E.
7.6.5.4 7.1.1.1
In the left-hand NAT table, add an entry NATs
that would allow A to communicate with
E. You may choose any port numbers you A B C D
like, but the internal port numbers should
be different from the external port 10.1.1.5 10.1.1.3 10.1.1.6 10.1.1.7
numbers.

Show the values of the address and port fields in the diagram below, for a typical packet
sent by host A.

src adr dest adr src port dest port


10.1.1.5 4.3.2.1 7777 80

Show the fields in the packet as it might appear when it reaches E.

src adr dest adr src port dest port


7.6.5.4 4.3.2.1 2222 80

Suppose the user in the right-hand network runs a game server on host D and invites her
friends to join her game sessions. Add an entry to the right-hand table that would allow
remote connections to the game server. Again, you may pick your own port numbers, but
the internal and external port numbers should be different. Assume host B connects to the
game server at D. Add an entry to the left-hand NAT table for this connection. Show the
address and port fields for a typical packet leaving host B, the fields in the same packet as it
passes through the public internet, and the fields in the packet that is delivered to D.

src adr dest adr src port dest port


10.1.1.3 7.1.1.1 7777 5555

src adr dest adr src port dest port


7.6.5.4 7.1.1.1 3333 5555

src adr dest adr src port dest port


7.6.5.4 10.1.1.7 3333 4444

-3-
4. (15 points) Does SSL use public key encryption? If so, what does it use it for and how does it
use it, in a typical situation?

Yes. Typically a server’s public key is signed using a certificate authority’s private key, so that a
client can use its copy of the CA’s public key to verify that that the key in the certificate really belongs
to the server. The client then uses the server’s public key to encrypt some secret information, which it
sends to the server. This information is then used to generate additional keys.

Does SSL use symmetric encryption? If so, what does it use it for and how does it use it?

Yes. After the initial handshake, the client and server encrypt data using symmetric encryption.

How many different keys are created for a typical SSL session? What are they used for?

Four keys are created, two encryption keys (one for each direction) and two MAC keys (one for each
direction.

Is it necessary for a single SSL record to be sent entirely within one IP packet? Why or why
not?

It is not. The TCP layer does not know about SSL records, it just sends bytes. So the IP packet
boundaries may come in the middle of SSL records. This does no harm, as SSL is unaware of IP
packet boundaries and simply operates on bytes.

Suppose an attacker learned the encryption key used by one endpoint of an SSL connection.
Could the attacker use this to modify one of the records in the connection, without this
being detected by the receiver? If so how, if not, why not?

No. While the attacker could encrypt the packet, without also knowing the MAC key, it could not
compute a new MAC to go with the modified record. Consequently, the receiver would be able to
detect the modification to the record.

-4-
google.com
5. (15 points) The diagram at right shows a server

corporate network with three sites Denver office


74.2.3.4
connected by the internet. The company’s

17.2.3.4
n etwork administrator has configured .1
A 29.1.5.5 .1
the gateway routers at the three sites to 29.1 internet
use IPsec to encrypt all traffic going Atlanta
C
between the three sites. How many 13.1.2.3
office

Security Associations are needed to allow corporate


17.1.7.7

the sites to communicate securely with B 13.1.8.8


headquarters

each other?

Six SAs are needed, two for each pair of offices (one in each direction).

If host A sends a packet to host C, what are the source and destination address fields in the
packet header as it passes through the public internet?

Source address is 29.1.1.1, destination address is 17.2.3.4.

If host B sends a packet to the Google server shown, what are the source and destination
address fields in the packet header as it passes through the public internet?

Source address is 13.1.8.8, destination address is 74.2.3.4.

How does a gateway router decide if an outgoing packet should be encrypted using IPsec?
How does it decide which Security Association to use, if it does require encryption?

It looks for a matching entry in its Security Policy Database (SPD), using the source and destination
address fields in the packet as part of the lookup key. If there is a matching entry, the packet should be
encrypted and the entry will include the Security Parameter Index (SPI) of the appropriate SA.

If the gateway router at Atlanta receives an IPsec packet from the public Internet, how does
it determine which encryption key to use when decrypting the packet?

The packet will include the SPI of the Security Association in cleartext. The receiving router will
lookup the entry for that SPI in its Security Association Database. This contains the encryption key
for the SA.

-5-
17 J
31 E
B
15 23
6. (10 points) In the diagram at right, the nodes 23 19 13
represent IP routers and the numbers on the links A 22 29
are OSPF link weights. If the network uses PIM D F
with reverse-path f orwarding, which links are 13 17 12 22
never used for multicast packets going to a host
C
connected to router J? H
15

The shortest path tree rooted at J includes the links EJ, FJ, BE, DE, CH, AD and FH. So the links that
would never be used for multicast packets going to a host at J are: EF, DF, DH, BD, AB, AC, CD.

Suppose that router C is the PIM DR for some layer 2 subnet, and that a host X in that
subnet sends an IGMP report for address 229.1.2.3. Assume that J is the RP for 229.1.2.3 and
that no other routers are currently participating in 229.1.2.3. What does router C do at this
point? Which routers eventually add forwarding state for 229.1.2.3 as a result of C’s action?

C would send a PIM Join packet to H. Eventually, routers C, H, F and J would add forwarding state
for 229.1.2.3.

If a host connected to router B sent a packet to 229.1.2.3, which routers would the packet
pass through in order to reach the host connected to the subnet at C? List them in the order
in which the packet passes through them.

It would pass through routers B, E, J, F, H and C.

How would the previous answer change if router C issued a source-specific join on 229.1.2.3
for the host at router B.

This would cause packets from B to pass through routers B. A and C.

If the host connected to the subnet at C sends a packet to 229.1.2.3, which routers receive a
copy? Assume that there has been no other activity on this multicast address, except for
what has been described in the earlier parts.

Routers C, H, F and J would all receive copies. J would simply discard its copy.

-6-
7. (10 points) Consider an audio/video teleconferencing session with ten participants in the
same switched layer 2 network. The application limits the number of simultaneous senders
to two. If the RTP session bandwidth is 4 Mb/s, how much bandwidth can be used for
RTCP packets, assuming the default behavior?

5% of the session bandwidth or 200 Kb/s.

Suppose that all participants send RTCP receiver reports and that at some point in time, two
hosts are sending RTCP sender reports. How much bandwidth does each receiver have for
its reports? How much does each sender have for its reports?

The RTCP bandwidth is split between senders and receivers with senders getting 25% of 200 Kb/s or
50 Kb/s. So each sender gets 25 Kb/s. Each receiver gets 15 Kb/s.

Suppose the number of participants in the conference increases to 20. In this case, how much
bandwidth is available to each sender for its reports? How many for each receiver?

The senders still get 25 Kb/s each. The receivers get 7.5 Kb/s each.

When a participant in the conference receives an audio packet, how does it determine the
actual time when the packet was sent, so that it can determine the appropriate playout
delay?

The audio packet contains a timestamp that is based on the audio sample clock. This is essentially just
just the value of an audio sample counter maintained by the source. To relate this to real-time, the
receiver uses information it received from the last sender report issued by the audio source. This
sender report relates the audio sample clock to the actual real-time.

-7-
8. (10 points) Consider a residential network that connects to the internet with a DSL link that
has a download rate of 4 Mb/s. Assume that there are three UDP flows sharing the link and
the remote hosts are sending at rates of 1 Mb/s, 2 Mb/s and 3 Mb/s. Assume that the ISP
router has a link buffer that can hold 300 packets (assume all packets have the same length).
For each flow, what fraction of the packets it sends are discarded?

They each lose about 33% of the packets they send.

For each flow, about how many packets does it have in the queue.

The first flow has about 50 packets in the queue, the second flow has about 100 and the third has 150.

Now, suppose the queue at the ISP router is replaced by three queues that can each hold 100
packets and that the queues are scheduled using weighted-fair queueing, where the weights
are all 0.33. In this case, what fraction of packets are discarded from each flow?

In this case, the first flow loses 0, the second loses 25% and the third loses 50%.

How many packets does each flow have in the queue?

The first flow’s queue is empty or close to empty. The other two each have about 100 packets in their
queues.

Now, suppose the weights are 0.2 for the first flow, 0.6 for the second and 0.2 for the third.
In this case, what fraction of packets are discarded from each flow?

In this case, the first two flows each lose 0, while the third loses 67%.

How many packets does each flow have in the queue?

The second flow’s queue is empty or close to empty. The third has about 100 packets in its queue.

The first flow is a little tricky, as its allocated portion of the link bandwidth exactly matches its data
rate. If the packets arrive with uniform spacing, the queue will remain close to empty, but if the times
between packets are more random, significant queueing can occur. Indeed, there can even be some
packet loss in this case. For a single flow however, it’s more likely that the queue will never
accumulate a large backlog.

-8-
9. (10 points) The diagram at right shows a WIFI network with an access
point, X and three hosts, A, B and C. The large circles indicate the coverage B
areas of the three hosts. The coverage area for X is not shown, but you may
assume that it includes all three hosts. Assume RTS/CTS are not used. A X

Suppose X is transmitting a packet at time 0 and finishes sending it at time C


100 µs. Also,
• A gets a packet to send at time 50 that takes 100 µs to send and is
assigned a backoff timer of 100.
• B gets a packet at time 70 that takes 200 µs and is assigned a backoff timer of 50.
• C gets a packet at time 90 that takes 150 µs and is assigned a backoff timer of 150.
For each of the three hosts, what time do they start sending their packets? You may ignore
the inter-frame spacing and the time required for acks.

A starts sending at time 200 and finishes at 300


B starts sending at 150 and finishes at 350
C starts sending at 350 and finishes at 500

Of the three packets sent, which are successfully delivered on the first attempt?

Only the one from C is successfully delivered.

For each packet that is not successfully delivered on the first attempt, approximately when
does the sending host learn that the packet was lost and must be sent again?

Hosts learn of lost packets from the absence of ACKs. Here, A would expect an ACK at 300 and so
would learn of the lost packet when the ACK fails to arrive at time 300. Similarly, B would learn of
its lost packet at time 350.

Now, suppose RTS/CTS is enabled. In this case, approximately when does each host send
its data packet? You may assume that the time needed to send RTS, CTS and ACK packets is
negligible.

A sends at 400.
B sends at 150.
C sends at 550.

-9-
CSE 473 – Introduction to Computer Networks Roch Guérin
Final Exam Solution
Your Name: 12/17/2014
PLEASE WRITE LEGIBLY – NO POINTS FOR ILLEGIBLE ANSWERS

1. [10 points] Bob has been provided with the following pair of encryption/decryption keys:
(2491,9);(2491,1329).
a) [3 points] Justify that Bob was given a valid RSA key pair (Hint: 2491 is divisible by 53).
Knowing that 2491 is divisible by 53, we readily find that the other prime factor in 2491 is 47.
Hence, the product (p-1)(q-1)=46*52=2392=2*23*2*2*13, so that the prime factors in (p-1)(q-1) are
2, 13, and 23. The encryption key e=9=3*3, therefore, satisfies the constraint that it be relatively
prime with 2392. It remains to verify that 1253 is a valid decryption key, i.e., is of the form
9*1329=(k*2392+1) for some value k. Simple computations show that 9*1329=(5*2392+1)=11961.
This establishes that Bob indeed received a valid RSA key.

b) [7 points] Bob receives a message in the form of the number “2”. What was the original
message/number that was sent to Bob? (Hint 250 mod 2491 = 2319. Taking a divide and
conquer approach to perform the required computation will help).
Decrypting the received number 2 to recover the original value requires raising 2 to the power 1329
(the decryption key) and obtaining the remainder after dividing this number by 2491, i.e., performing
a modulo 2491 operation.
From the hint, we know that 250 mod 2491 = 2319. We can use this result to progressively compute
2100 mod 2491 = (2319*2319) mod 2491 = 2183, 2200 mod 2491 = (2183*2183) mod 2491 = 206,
2400 mod 2491 = (206*206) mod 2491 = 89, 2800 mod 2491 = (89*89) mod 2491 = 448,
21200 mod 2491 = (448*89) mod 2491 = 16, 21300 mod 2491 = (16*2183) mod 2491 = 54, and finally,
21329 mod 2491 = (54*628) mod 2491 = 1529.
Hence the original message sent to Bob was 1529.

-1-
2. [15 points] A corporate network connects to the Internet over a duplex 100 Mbps (10 8

bits/sec) link.
a) [4 points] The 100 Mbps connection is shared by four distinct departments, which at
peak hour have upload rates of UDP traffic equal to 25 Mbps, 50 Mbps, 75 Mbps, and
100 Mbps, respectively. What fraction of the 100 Mbps Internet link bandwidth would
each department approximately get if their traffic shared a single queue?
Each flow gets a fraction of the link bandwidth proportional to its own rate divided by the sum of the
upload rate. Hence, the department with a 25 Mbps upload bandwidth gets 25*100/(25+50+75+100)
= 10 Mbps, the department with a 50 Mbps upload bandwidth gets 50*100/(25+50+75+100) = 20
Mbps, the department with a 75 Mbps upload bandwidth gets 75*100/(25+50+75+100) = 30 Mbps,
while the department with a 100 Mbps upload bandwidth gets 100*100/(25+50+75+100) = 40Mbps.

b) [2 points] Assume now that each department is assigned its own queue, where each
queue is served according to a weighted fair queueing (WFQ) scheduler with equal
weights for each queue. Under this assumption, what bandwidth share does each
department get?

Under the assumption of equal weights, each department gets up to 25 Mbps.

c) [4 points] How should the weights of the scheduler be set to ensure that each flow gets a
share of the bandwidth that is proportional to its own rate?
Assigning weights of 0.25, 0.5, 0.75 and 1 to the 25 Mbps, 50 Mbps, 75 Mbps, and 100 Mbps flows,
respectively, would achieve the desired outcome. Alternatively, normalized weights of 0.1, 0.2., 0.3
and 0.4 would also realize the same outcome.

d) [5 points] Identify a set of scheduler weights that would ensure that the departments
with 25 Mbps and 50 Mbps get their upload demand fully satisfied, while the other two
departments would share the remaining bandwidth equally.
Assigning weights of 0.25 and 0.5 to the departments with upload bandwidth requirements of 25
Mbps and 50 Mbps, respectively, would ensure their traffic demands are fully met. The other two
departments would be assigned weights of 0.125 each.

-2-
3. [15 points] The network below consists of two routers, R1 and R2, and seven Ethernet
switches, A to G. The switches are configured with three VLANs and the labels next to each
link show the VLANs active on the link. Some links are in multiple VLANs. VLAN 1 is
assigned subnet 1.0.0.0/8, VLAN 2 subnet 2.0.0.0/8 and VLAN 3 subnet 3.0.0.0/8. Note that
each VLAN forms a spanning tree to start with. R1 and R2 each belong to two subnets and
can send/receive packets on the corresponding VLANs. They are the default gateway for
their subnet, i.e., 2.0.0.0/8 for R1 and 3.0.0.0/8 for R2, with router R1 also the default
gateway for the subnet they have in common, 1.0.0.0/8. In addition, R1 hosts the DNS
server for the network, and offers connectivity to the Internet.
1.0.0.1
h1 2 A 2.0.0.1
2.0.0.3 2
B 1,2
h2 3 R1 Internet
C 1,2
3.0.0.3 1,2
3 D 1,2,3
E 2
3 1,3 h5
1.0.0.2 1,3 G 1 2.0.0.4
3.0.0.1 R2 3
3 3 F
h3 h4 1
3.0.0.4 1.0.0.3
Five hosts, labeled h1 to h5, are shown in the diagram. Hosts belong to the VLAN of their
IP subnet.
a) [5 points] Host h1 boots up with an empty ARP cache, and needs to communicate with
IP addresses: 2.0.0.1, 1.0.0.1, and 5.1.1.1. Identify what MAC addresses are present in
which switch after the connections have been established. Your answer should be a list
of entries of the form: Switch X: MAC address of IP x, MAC address of IP y, … , etc.
Host h1 and IP address 2.0.0.1 are in the same subnet, so h1 broadcasts an ARP query on VLAN2
and the response comes back directly to it. All switches in VLAN2 create a forwarding entry for the
MAC address of 2.0.0.3, and switches A and B create an entry for the MAC address of 2.0.0.1.
IP address 1.0.0.1 is not in the same subnet as host h1. Hence h1 broadcasts an ARP query for its
gateway router R1, with the response again coming back directly to it. The switches in VLAN2
already have a forwarding entry for the MAC address of 2.0.0.3, but switches A and B create an entry
for the MAC address of 1.0.0.1. Because, IP address 1.0.0.1 is that of R1, no additional ARP query
(by R1) is required to establish the connection.
IP address 5.1.1.1 is again not in the subnet of host h1, but it already has the MAC address of R1.
Hence, no new ARP query is required, and no additional MAC entries are created in the switches.
The forwarding entries created in the switches are therefore as follows:
Switch A: MAC address of 2.0.0.3, MAC address of 2.0.0.1, MAC address of 1.0.0.1
Switch B: MAC address of 2.0.0.3, MAC address of 2.0.0.1, MAC address of 1.0.0.1
Switch D: MAC address of 2.0.0.3
Switch E: MAC address of 2.0.0.3
Switch F: MAC address of 2.0.0.3.
None of the other switches create any forwarding entry because of the connections.
Note that because IP addresses 2.0.0.1 and 1.0.0.1 are both associated with router R1, they may or
may not correspond to different MAC addresses.

-3-
1.0.0.1
h1 2 A 2.0.0.1
2.0.0.3 2
B 1,2
h2 3 R1 Internet
C 1,2
3.0.0.3 1,2
3 D 1,2,3
E 2
3 1,3 h5
1.0.0.2 1,3 G 1 2.0.0.4
3.0.0.1 R2 3
3 3 F
h3 h4 1
3.0.0.4 1.0.0.3
b) [3 points] Host h3 has an established communication with host h5. What sequence of
switches and routers does it go through? Explain why and list them in order, repeating
switches the packet traverses more than once, if any.
Hosts h3 and h5 are in different subnets with R2 serving h3 and R1 serving h5. The path followed by
the connection’s packets is, therefore: G,R2,G,D,F,B,R1,B,E.

c) [3 points] While h3 has a connection to h5, h2 has one to h4, and h1 has a connection to a
remote host on the Internet. Assuming that all links are duplex 1 Gbps (109 bits/sec),
except for link B-R1 that is 10 Gbps and that there is no other meaningful traffic on the
network and no other limitation except the Ethernet network itself, what is the
maximum bandwidth each connection can get? Justify your answer.
The connection from h2 to h4 follows the path C,G,R2,G,D,F while the connection between h1 and
the Internet follows the path A, B,R1. Hence, the links G,R2; R2,G; G,D; and D,F are common to
connections h3-h5 and h2-h4. This means that each connection gets approximately 1/2 of the link
bandwidth or 500 Mbps. Conversely, link B-R1 is common to connections h3-h5 and h1-Internet, but
because its capacity is 10 Gbps it is not a bottleneck link and the connection h1-Internet has a
maximum bandwidth of 1 Gbps.

d) [4 points] Can you suggest a single change in either VLAN topology or assignment of IP
addresses that would allow each connection to reach a maximum bandwidth of 1 Gbps?
If yes, what is it? If no, why not?
Consider changing the IP address of h4 to 3.0.0.5. This results in h2 and h4 being on the same
subnet, so that the path for connection h2-h4 is now C,G,F. This is disjoint from the other two paths.
The path between h3 and h5 and that between h1 and the Internet only share the link between B and
R1 that is 10 Gbps. Hence all three paths are now link disjoint in the Ethernet network itself, so that
the maximum possible bandwidth of each connection is 1 Gbps.

-4-
4. [15 points] Consider the WiFi network shown below with two access points, X and Y, and
four active hosts, A, B, C, and D, with A and B associated with X and C and D associated
with Y. The two access points are operating on the same channel. Host A can hear host B,
but not hosts C and D. Host B can hear hosts A and C, but not host D. Host C can hear
hosts B and D, but not host A. Host D can hear host C, but not hosts A and B. All four hosts
can hear and be heard by both access points X and Y, which can also hear each other.
X Y

A B C D

a) [7 points] Assume that


At t=0 access point X is transmitting and continues transmitting until t=400µs.
At t=50µs, host A gets a packet to send and initializes its backoff timer to 350µs.
At t=100µs, host B gets a packet to send and initializes its backoff timer to 300µs.
At t=150µs, host C gets a packet to send and initializes its backoff timer to 200µs.
At t= 350µs, host D gets a packet to send and initializes its backoff timer to 50µs.
All packets have a transmission time of 200µs, and RTS/CTS is not used.
Under those assumptions, identify when each host starts its packet transmission, and
specify which packets are successfully transmitted in their first attempt. For simplicity,
assume that inter-frame spacing times and times to send ACK packets are negligible.
All hosts keep their backoff timer frozen until X stops its transmission at t=400µs. Host D has the
smallest backoff timer at, therefore starts transmitting at t=450µs. Host C is the only host that hears the
transmission and, therefore, stops its backoff timer with a value of at 150µs. Both hosts A and B continue
decrementing theirs. Host D finishes its transmission at t=650µs, at which point the value of host B’s
backoff timer is 50µs and that of A’s backoff timer is 100µs. The backoff timer of host C is still at 150µs,
but it now resumes decrementing it. The next timer to expire is that of B that starts transmitting at
t=700µs. Both A and C hear B’s transmission and, therefore, stop their backoff timers that are at values
50µs and 100µs, respectively. B finishes its transmission at t=900µs, at which point both A and C
restart decrementing their backoff timers. A’s timer expires first at t=950µs at which point A starts
transmitting. Unfortunately, C does not hear A’s transmission, so that is keeps decrementing its own
backoff timer and eventually starts its own transmission at t=1000µs. This results in a collision with A’s
transmission so that neither are successful in their first attempt. In summary, packet transmissions and
successes/failures are as follows:

Host Starts transmission at Successful?

A t=950µs No

B t=700µs Yes

C t=1000µs No

D t=450µs Yes

-5-
b) [8 points] Repeat the previous question assuming that RTS/CTS is now enabled for all
packet transmissions. In this case, approximately when does each host send its data
packet, and which ones are successfully received in their first attempt? For simplicity,
assume that the time needed to send RTS, CTS and ACK packets is negligible.
Recall
X Y

A B C D

And that
At t=0 access point X is transmitting and continues transmitting until t=400µs.
At t=50µs, host A gets a packet to send and initializes its backoff timer to 350µs.
At t=100µs, host B gets a packet to send and initializes its backoff timer to 300µs.
At t=150µs, host C gets a packet to send and initializes its backoff timer to 200µs.
At t= 350µs, host D gets a packet to send and initializes its backoff timer to 50µs.
Host D sends its RTS at 450µs and gets granted permission to send until 650µs by Y. Host C hears
the CTS, and therefore stops decrementing its backoff timer until t=650µs. Because both A and B are
associated with X, they ignore the CTS from Y, and therefore continue decrementing their backoff
timers, i.e., the use of RTS/CTS does not help in this case. Hence, when D finishes transmitting, the
values of their backoff timers are as before equal to 100µs and 50µs, respectively, while C’s backoff
timer is still at 150µs. The next timer to expire is that of B that sends an RTS at t=700µs and
immediately receives a CTS from X that grants it permission to transmit until t=900µs. A hears the
CTS and, therefore, stop its backoff timer at 50µs, while C also stops decrementing its backoff timer
because it hears the transmission from B. C’s backoff timer, therefore, stays at 100µs while B is
transmitting. B finishes its transmission at t=900µs, at which point both A and C restart
decrementing their backoff timers. A’s timer expires first at t=950µs, at which point it sends an RTS
and immediately receives a CTS from X that grants it permission to transmit until t=1150µs.
Unfortunately, because C is associated with Y, it does not pay attention to the CTS from X and,
therefore continues decrementing its backoff timer that eventually expires at t=1000µs. This again
results in a collision with the transmission from A, when C sends its RTS to Y (the transmission
interferes with the X’s reception of A’s transmission). Hence, transmission times and transmission
successes/failures are identical to those of the previous case.
Host Starts transmission at Successful?

A t=950µs No

B t=700µs Yes

C t=1000µs No

D t=450µs Yes

-6-
5. [15 points] Consider the network shown below that is configured as a three area OSPF
network. As usual, area 0 is the backbone area that provides connectivity between areas 1
and 2. The routers F1 and G1 are two area border routers (ABRs) that are in both areas 0
and 1, and conversely routers F2 and G2 are two area border routers that are in both areas 0
and 2. All links have the same bandwidth and have been assigned an OSPF weight of 1.

a) [3 points] Consider the routerLSA originated by router A2, and for each router in the
network, identify the maximum number of copies it can get.
The routerLSA from router A2 is flooded only in area 2, and the maximum number of copies that a
router can get is equal to its degree in area 2, i.e., B2 can get two copies, C2 can get three copies, D2
can get two copies, E2 can get four copies, F2 can get three copies, and G2 can get two copies. All
other routers get zero copies.

b) [5 points] Assume next that router B2 advertises a route to subnet r in its routerLSA
with a local cost of 1. What is the shortest path distance to r computed at router E1
together with its next hop(s)? Explicitly identify all steps involved in this computation,
i.e., how E1 learns about r and how it computes its shortest path and next hop(s) to r.
Routers F2 and G2 both compute shortest paths to router B2 using the Dijkstra algorithm and their
knowledge of the internal topology of area 2. They will then advertise a T3-summary LSA for r in
area 0 with a cost that is that of the shortest path to r. Routers F1 and G1 will receive the T3-
summary LSA and compute their shortest path to r by adding the distances to F2 and G2 to the
shortest path distance that each advertises for r. They will then flood a T3-summary LSA in area 1
announcing reachability to r with a distance that is that of their shortest path to r. Finally, router E1
will compute its shortest paths to F1 and G1 and determine its own shortest path to r by adding this
distance to the shortest path distance that each advertises in their T3-summary LSA.
Specifically, F2 and G2 both have a distance of 2+1=3 to r, which is what they advertise in the T3-
summary LSA flooded in area 0. Both F1 and G1 have a distance of 1 to F2 and G2, so that their
shortest path to r has a total distance of 4, which is what they advertise in their T3-summary LSA in
area 1. Router E1 receives the T3-summary LSAs and has a shortest path distance of 1 to both F1
and G1. Hence, E1 has a shortest path distance of 5 and next hops of F1 and G1.

-7-
c) [3 points] The link C2-D2 in area 2 fails. Which routers become aware of the fact that a
change occurred in the network, and which don’t? Justify your answer.
The failure or the link C2-D2 is detected trhough the Hello protocol between C2 and D2 and triggers
the flooding in area 2 of updated routerLSAs from routers C2 and D2. The LSAs are received by all
routers in area 2, which therefore become aware of the failure (change in topology) All area 2 routers
then proceed to recompute shortest paths to destinations in area 2. This includes the two ABRs F2
and G2. However, the failure of the link does not change the minimum distance of any shortest path
at either F2 or G2. Hence, they do not flood updated T3-summary LSAs in area 0, and therefore
neither F1 nor G1 (nor for that matter any of the routers in area 1) ever become aware of the failure.

d) [4 points] Assume now that the following local subnets are included in the routerLSAs
of the different routers in area 2, all with a local cost of 1:
− Router A2: 10.1.0.0/24
− Router B2: 10.1.1.0/24
− Router C2: 10.1.2.0/24
− Router D2: 10.1.4.0/24
− Router E2: 10.1.5.0/24
− Router F2: 10.1.3.0/24
− Router G2: 10.1.6.0/23
What is the smallest number of T3-summary LSAs that F2 and G2 need to advertise and
what distance(s) do they advertise for each? Justify your answer.
The seven subnets can be aggregated into 10.1.0.0/21, so that F2 and G2 only need to advertise a
single T3-summary LSA. The distance advertised in the T3-summary LSA will be the maximum of
the distances to the individual subnets being aggregated.
This will, therefore, be a distance of 2+1=3 for F2 and 3+1=4 for G2 (G2 has a distance of 3 to A2).

-8-
6. [10 points] Consider the network below, where nodes are IP routers and the number next to
each link is its OSPF link weight. The network is configured as a single OSPF area.

a) [4 points] Router A is the PIM DR for some layer 2 subnet, and host X in that subnet
sends an IGMP report for address 226.1.1.1. Router G is the RP for 226.1.1.1, but no
routers are currently participating in 226.1.1.1 (interested in packets for 226.1.1.1), and
no host is actively sending packets to 226.1.1.1. What does router A do when receiving
the IGMP report from X? Do any routers eventually add forwarding state for 226.1.1.1
as a result of A’s action? If yes, which ones? If no, why not?
The receipt of the IGMP report from X triggers A to send a PIM Join packet on the shortest path
towards the RP, namely to router C towards router G. Eventually, routers C, F and G would add
forwarding state for 226.1.1.1. Note that this is independent of whether or not there are any host
actively sending multicast packets to 226.1.1.1. A would also have forwarding state pointing to the
local subnet of X.

b) [3 points] Assume next that host Y on a layer 2 subnet for which router D is the PIM DR
sends an IGMP report for 226.1.1.1. What action would this trigger at router D, and
would this result in the creation of any additional forwarding state?
The receipt of the IGMP report from Y triggers D to send a PIM Join packet on the shortest path
towards the RP, namely to router F towards router G. This results in the creation of additional
forwarding state at F (another branch towards D), but since the multicast tree is already in place at F,
the PIM Join message would not be forwarded any further. In addition, as with A, D creates
forwarding state towards the local subnet of Y.

c) [3 points] A host connected to a layer 2 subnet attached to router C starts sending


multicast packets addressed to 226.1.1.1. Identify all the steps this would trigger to
ensure the delivery of these packets to subscribers of the multicast group. In particular,
identify all routers the packets will traverse and in which form, as well as any additional
control messages this may trigger.
Because C is already on the multicast tree for 226.1.1.1, packets can be readily forwarded as native
multicast packets. They will be forwarded from C to A and F, and from F to D and G. Once the
packets arrive to D and A, the routers will forward them on the local subnets to which hosts X and Y
belong. No additional (PIM) control messages are needed. G would simply discard the packets when
they arrive, since there are no other tree branches on which to forward them.

-9-
7. [15 points] Consider the diagram below that displays connectivity between AS11 and
several other ASes. AS11 uses OSPF as its internal routing protocol, and BGP to exchange
routes with neighboring ASes. The four routers in AS11, A, B, C, and D, are connected by a
full iBGP mesh.
AS11 has peering relationships with AS1, AS2 and AS4 and only advertises its own routes to
them, while they advertise their own routes and those of their customers to AS11. AS11 is
itself a customer of the two ASes labeled ISP1 and ISP2, which offer Internet connectivity to
AS11 by advertising all the routes they know on their eBGP connections to routers D and C,
respectively. Assume that the sets of routes learned from both ISP1 and ISP2 are identical.
The prefixes shown inside AS1, AS2, AS3, and AS4 identify the internal route they advertise
to their eBGP neighbors. In addition, AS2 provides transit service to both AS1 and AS3, i.e.,
they are customers of AS2. Hence, AS2 also advertises the routes it learns from AS1 and
AS3 to AS11, as well as advertises to them the routes it learns from AS11. Finally, like AS11,
AS4 is a customer of ISP1 that offers it Internet connectivity by advertising it all its routes.
AS11 assigns a LOCAL_PREF value of 10 to all routes learned by routers C and D over their
eBGP connections to ISP2 and ISP1, respectively. It assigns a LOCAL_PREF value of 50 to
routes learned by both routers A and D over their eBGP connections with AS1 and AS4,
respectively, and a LOCAL_PREF value of 100 to routes learned by router B over its eBGP
connection with AS2.

AS3
3.0.0.0/8

AS1 AS2
1.0.0.0/8 2.0.0.0/8

3 B 11.3.0.0/16
11.0.0.0/16 A AS11
11.0.0.0/14 2
AS4 9 1
4.0.0.0/8
C 11.2.0.0/16
11.1.0.0/16 D 1

ISP2
ISP1

- 10 -
a) [7 points] Specify the routing table at router B, and for each entry identify the next
hop(s) in the form of either a local connection, or connections to internal routers, or a
neighboring AS, as applicable. For conciseness, you can represent the set of routes
advertised by ISP1 and ISP2 (both advertise the same set) as “ISP”. For each entry,
explain your choice, i.e., how and why it was selected by router B.
AS2 advertises 1.0.0.0/8, 2.0.0.0/8 and 3.0.0.0/8 to router B. Those routes have AS_PATHs of the
form <AS1><AS2>, <AS3><AS2>, and <AS2>, respectively, and are assigned a LOCAL_PREF
value of 100.
AS1 advertises 1.0.0.0/8 to router A. The route has an AS_PATH of the form <AS1> and is assigned
a LOCAL_PREF value of 50.
AS4 advertises 4.0.0.0/8 to router D. The route has an AS_PATH of the form <AS4> and is
assigned a LOCAL_PREF value of 50.
ISP1 advertises “ISP” to router D. AS_PATHs will vary, but LOCAL_PREF values are all 10.
ISP2 advertises “ISP” to router C. AS_PATHs will vary, but LOCAL_PREF values are all 10.
The routing table at B is, therefore, of the form:

Route Next hop(s) & Reason

“ISP” C (lowest internal cost of 2 to either C or D that have equal LOCAL_PREF)

11.0.0.0/16 A and C (equal lowest internal costs of 3)

11.1.0.0/16 C (lowest internal cost of 3)

11.2.0.0/9 C (lowest internal cost of 2)

11.3.0.0/16 Local

1.0.0.0/8 AS2 (highest LOCAL_PREF that trumps the shorter AS_PATH of the route
advertised by AS1 to A)

2.0.0.0/8 AS2 (highest LOCAL_PREF)

3.0.0.0/8 AS2 (highest LOCAL_PREF)

4.0.0.0/8 C (lowest internal cost of 3 to exit point, router D)

b) [3 points] How would the routing table at B change, if at all, if the LOCAL_PREF value
assigned to routes learned by A was changed from 50 to 100? Justify your answer.
The only change would affect the route 1.0.0.0/8, as the routes learned by routers A and B now have
the same LOCAL_PREF value. The shorter AS_PATH of the route learned by A would now ensure
that it becomes the preferred exit point to reach 1.0.0.0/8. Hence, the corresponding route entry in
B’s routing table would now have a next hop of A.

- 11 -
c) [3 points] Assume now that AS11 changes its relationship with ASes 1, 2, and 3, and
becomes their provider, i.e., offers them Internet connectivity. However, AS11 wants to
ensure that all their traffic enters through router B, except for the traffic from AS1 to AS4
that should enter through router A. How would AS11 be able to realize such a goal?
Justify your answer.
The easiest option to realize such a goal is to have router A advertise 4.0.0.0/8 to AS1 and have router
B only advertise a default route 0.0.0.0/0 to AS2. This will ensure that the traffic from AS1 to AS4
enters through router A (the more specific prefix is preferred) and that all other traffic goes through
AS2 and enters through router B. Note that AS1 would not advertise 4.0.0.0/8 to AS2 since it is a
route it learned from a provider, and it also has a customer-provider relationship with AS2
(advertising 4.0.0.0/8 to AS2 would allow traffic destined for 4.0.0.0/8 to flow from AS2 through
AS1, and consequently make AS1 into AS2’s provider, at least for prefix 4.0.0.0/8).

d) [2 points] AS11 would like to ensure that traffic destined for the Internet and coming
from AS2 (entering through router B) is distributed more or less equally between ISP1
and ISP2. Is this feasible simply by adjusting the OSPF weights of internal links? If yes,
explain why. If not, justify why it is not feasible.
Unfortunately, because the BGP protocol only allows the selection of a single path, router B has to
pick either ISP1 or ISP2 as its exit point to reach Internet destinations. Hence, no matter how OSPF
weights are set, Internet traffic from B will only be forwarded to one exit point.
Note that internal weights can, however, be used to determine which exit point is picked by which
internal router, when the internal path cost is the tie-breaker of the BGP decision process. This is not
the case here since we have only one internal router to consider, namely, B.

- 12 -
CSE 473 – Introduction to Computer Networks Roch Guérin
Final Exam Review Solution
12/4/2014

1) The diagram at right shows a switched Ethernet


LAN with two routers (labeled Q and R), seven
switches and five hosts. The switches are
configured with three VLANs and the labels next
to each link show the VLANs active on the link
(note, some links are active in multiple VLANs).
3
Each VLAN is assigned an IP subnet.
Specifically, VLAN 1 is assigned subnet 1.0.0.0/8,
VLAN 2 subnet 2.0.0.0/8 and VLAN 3 subnet
3.0.0.0/8. The two routers each belong to two
subnets and can send/receive packets using two
VLAN ids. Both routers are on subnet 1.0.0.0/8,
but router R is the default gateway for the subnet.
Hosts are configured with the VLAN
corresponding to their IP subnet.
a) If host B sends a packet to host C, what switches and routers does the packet pass
through? Explain why and list them in order, repeating any switch the packet traverses
more than once. Note that each VLAN forms a spanning tree to start with.
B and C are in the same subnet, so they communicate directly and packets simply go through
switches x and v.

b) If host A sends a packet to host B, what switches and routers does it pass through?
A and B are in different subnets. Their path therefore includes at least one router. A is on subnet
1.0.0.0/8 and, therefore, forwards its packets to router R, that then delivers them to router Q that is
connected to subnet 2.0.0.0/8 to which B belongs. Hence the path is w,z,R,z,w,u,Q,u,x.
c) If B sends a packet to E, what switches and routers does it pass through?
B and E are again on different subnets, so routers must be involved. Using a similar reasoning as in
the previous question, the path is x u,Q,u,w,z,R,z,t,y.
d) If C transfers a large file to E while B transfers a large file to D, what maximum data rate
could each approximately get, assuming that the links are all 1 Gb/s duplex links?
The two paths are v,x,u,Q,u,w,z,R,z,t,y and x,u,Q,u,w,z,t (note that the return path from D to B is
slightly different, i.e., t,z,R,z,w,u,Q,u,x). They have links x,u; u,Q; Q,u; u,w; w,z; and z,t in
common, so each gets at most approximately half those links bandwidth or 500 Mb/s.

e) What maximum bandwidth could they each get if E was in subnet 2.0.0.0/8 instead?
In that case, they could each get up to 1 Gb/s since the paths are now link disjoint.

-1-
2) Consider the bridged Ethernet network shown below, where circles represent Ethernet
bridges, and lines Ethernet LAN segments connecting them. All LAN segments operate at
the same speed of 1 Gbps (109 bits/sec). The number inside each circle indicates the priority
level of the bridge, with lower values corresponding to higher priority. Because of an error
made by the network administrator who decided to over-ride the default configuration in a
bridge, two bridges have been assigned the highest priority value of 1.

a) Describe the final spanning tree configuration for this network, and identify the state of
every single port in the network, i.e., RP, DP or blocking. Justify your results and explain
any problem created by the fact that two bridges were assigned priority 1.
The spanning tree construction starts irrespective of the fact that two bridges have been assigned the
same highest priority value. All bridges eventually select “the” bridge with the priority value of 1 as
the root bridge, but because there are two choices they end-up choosing the one closest to them.
Specifically, bridges 3 and 6 select as root the priority 1 bridge to which they are directly attached
(this has the lowest cost). Conversely, bridges 2 and 4 select as root the priority 1 bridge to which they
are directly attached (this has again the lowest cost). Bridge 5 learns of three different paths to a root
bridge with priority 1; all with the same cost of 2. It selects the path through bridge 2 that has the
highest priority. This results in two disconnected spanning trees as shown below.

b) Assume next that our network administrator reconfigured the network so that the
spanning tree that was finally formed is as shown in the figure below.

-2-
(i) Under the spanning tree configuration shown in the figure, is any bridge not
forwarding data packets? If no, identify for each bridge the LAN segments to
and from which it forwards data packets. If yes, explain why some bridges may
not be forwarding data packets.
Because bridges 5 and 7 have no DP, they will not be forwarding any data packets. They may
receive packets on their RP, but since they have no LAN segments attached to them for which
they are the DP, they won’t be forwarding those packets anywhere. Similarly, because they don't
have any DP port, they won’t be receiving any packet that should be forwarded on their RP.

(ii) As shown in the figure, a major server is located on the LAN for which bridge 3
is the DB. This LAN runs at 10 Gbps, but all other LANs are 1 Gbps LANs. At
any given time, there are on average 10 users in each LAN that are downloading
material from the server. Given the current spanning tree configuration, the LAN
between bridges 1 and 3 is, therefore, the most heavily loaded. Suggest a new
configuration that involves lowering down to, say, 0, the priority of a single
bridge and that results in the largest reduction in the load of the most loaded
LAN. Justify your choice and explicitly identify the ratio by which the load of the
most loaded LAN is reduced, i.e., compare the load of the LAN between bridges
1 and 3 in the current configuration to the load of the most loaded LAN in your
configuration.
Assuming each LAN generates a unit load to the server, the LAN between bridges 1 and 3 carries
a load of 7 units in the current configuration. In order to reduce the maximum load as much as
possible, we would like to use as many LANs as possible to reach the server. This can be realized
by making either bridge 5 or bridge 6 as the root bridge. As shown in the figures below, both
distribute the incoming server traffic on four distinct LAN segments, with the most loaded
segment carrying traffic originating from 4 outer LAN segments instead of 7. Hence the load of
the most loaded LAN is reduced by a factor 4/7.

-3-
3) In the diagram at right, nodes are IP routers and the
numbers on the links are OSPF link weights.
a) If the network uses PIM with reverse-path
forwarding, are any links never used for
forwarding multicast packets coming from a host
connected to router J?
The shortest path tree rooted at J includes the links EJ, FJ, BE, DE, CH, AD and FH. So the links that
would never be used for multicast packets coming from a host at J are: EF, DF, DH, BD, AB, AC,
CD.
Recall that under reverse-path forwarding, a router forwards multicast packets only if they are
received on the link corresponding to the shortest to the sender.

b) Suppose that router C is the PIM DR for some layer 2 subnet, and that a host X in that
subnet sends an IGMP report for address 229.1.2.3. Assume that J is the RP for 229.1.2.3
and that no other routers are currently participating in 229.1.2.3. What does router C do
at this point? Which routers eventually add forwarding state for 229.1.2.3 as a result of
C’s action?
C would send a PIM Join packet on the shortest path towards the RP, namely to router H.
Eventually, routers C, H, F and J would add forwarding state for 229.1.2.3.

c) If a host connected to router B sent a packet to 229.1.2.3, which routers would the packet
pass through in order to reach the host connected to the subnet at C? List them in the
order in which the packet passes through them.
The packet would be encapsulated in a unicast packet address to J, and would therefore pass through
routers B and E before arriving at J, which would then decapsulate it before forwarding it as a
multicast packet to router F. Router F would forward it to H, which would then forward it to C that
would eventually deliver it on its local subnet. Hence, the packet would pass through routers B, E, J,
F, H and C.

d) How would the previous answer change if router C issued a source-specific join on
229.1.2.3 for the host at router B.
The multicast tree would now bypass the RP and be directly rooted at B. Hence packets would now
be directly forwarded from B, to A and then C.

e) If the host connected to the subnet at C sends a packet to 229.1.2.3, which routers receive
a copy? Assume that there has been no other activity on this multicast address, except
for what has been described in questions a), b), and c).
Routers C, H, F and J would all receive copies. J would simply discard its copy since it is arriving on
the interface it would use to forward a packet to the only subscribed recipient for this multicast
address.

-4-
4) Consider a corporate network connected to the Internet at two separate locations.
a) The network has been allocated the following blocks of addresses by its Regional
Internet Registry (RIR): 149.16.23.0/22; 149.16.24.0/22; and 149.16.30.0/22. What is the
smallest number of additional address blocks it would need to request, and what would
those blocks be, if it wanted to be able to advertise a single route to the rest of the
Internet? And what would that route be?

The binary representations of the third bytes of the above three routes are as follows:

23 = 000101 11
24 = 000110 00
30 = 000111 10

where the bit values in bold-face are the only ones significant given the /22 mask size of the three
routes. If the network administrator requests one additional /22 address block, namely,
149.16.16.0/22 (third byte has value '000100 00'), then the network administrator could configure its
network to advertise to the Internet the single route 149.16.16.0/20.

b) Assume that there are 12 routers in the network and that the three address blocks of the
previous question are sub-divided to allocate one subnet of the same size to each router.
What is the mask size of the subnet allocated to each router?
Each /22 address block can be split into four /24 subnets, for a total of twelve such subnets; one for
each routers. As a result, each router is allocated one /24 subnet.

c) Two of the twelve routers in the network are connected to the Internet, and are therefore
the “exit” points from the network for reaching remote destinations. Those two routers
learn of remote routes through the BGP protocol (up to 300,000 routes), but advertising
all those routes into the corporate network is not feasible. Suggest a solution that would
work independent of the internal routing protocol used in the network and that would
allow those two routers to advertise that they can offer connectivity to the Internet.
The easiest option is for both routers to advertise a default route (0.0.0.0/0). This will ensure that any
destination address that is not a match for one of the local subnets is a match of a route advertised by
both of those routers.

-5-
5) Consider a residential network that connects to the internet via a 4 Mb/s DSL link. Assume
that three UDP flows share the link, each sending at rates of 1 Mb/s, 2 Mb/s and 3 Mb/s.
Assume that the ISP router has a link buffer that can hold 300 packets (assume all packets
have the same length). For each flow, what fraction of the packets it sends is discarded?
Assuming a single shared queue, each flow gets a fraction of the 4 Mb/s bandwidth that is
proportional to its transmission rate compared to the aggregate input rate. In other words, the 1
Mb/s flow gets a bandwidth of about 2/3 Mb/s, the 2 Mb/s flow gets a bandwidth of about 4/3 Mb/s
and the 3 Mb/s flow gets a bandwidth of about 2 Mb/s. Hence, each flow loses about 33% of the
packets they send.

a) How many packets does each flow approximately have in the queue?
The number of packets that each flow has in the queue is proportional to the fraction of the output
bandwidth it gets. Hence, the first flow has about 50 packets in the queue, the second flow has about
100 packets, and the third flow has about 150 packets.

b) Now, suppose the queue at the ISP router is replaced by three queues that can each hold
100 packets and that the queues are scheduled using weighted-fair queueing, where the
weights are all 0.33. In this case, what fraction of packets are discarded from each flow?
In this case, the first flow loses 0% of its packets (the first flow consumes a share of the bandwidth
equal to min(1Mb/s, 4/3 Mb/s)=1Mb/s). The second and third flows equally share the remaining 3
Mb/s of bandwidth, and therefore each get 1.5 Mb/s. Hence, the second flow loses 25% of its packets,
and the third flow loses 50% of its packets.

c) In this configuration, how many packets does each flow have in its queue?
The first flow’s queue is empty or close to empty. The other two flows each have about the maximum
number of 100 packets in their queues.

d) Now, suppose the weights are 0.2 for the first flow, 0.6 for the second and 0.2 for the
third. In this case, what fraction of packets is discarded from each flow?
In this configuration, the second flow consumes a bandwidth share of min(2Mb/s, 0.6*4
Mb/s)=2Mb/s, and the first and third flows equally share the remaining 2 Mb/s ,i.e., each get 1 Mb/s.
As a result, and assuming a 100 packets queue, the first flow should lose close to 0%, though this
depends on how packets arrive, and it could even experience some losses. The third flow loses
approximately 67% of its packets.
e) How many packets does each flow approximately have in its queue?
The second flow’s queue is empty or close to empty. The third flow’s queue is about full with about
100 packets.
As alluded to above, because the first flow is allocated a fraction of the link bandwidth that exactly
matches its data rate, the queue load is 1. If packets arrive regularly, the queue will remain mostly
empty, but if arrivals are highly bursty, significant queueing and losses could occur. For a single
flow however, it’s more likely that the queue will never accumulate a large backlog.

-6-
6) (10 points) The diagram at right shows a WIFI network with an access
point, X and three hosts, A, B and C. The large circles indicate the
coverage areas of the three hosts. The coverage area for X is not shown,
but you may assume that it includes all three hosts. Assume RTS/CTS
are not used.
Suppose X is transmitting a packet at time 0 and finishes sending it at
time 100µs. Also,
• A gets a packet to send at time 50 that takes 100µs to send and is
assigned a backoff timer of 100µs.
• B gets a packet at time 70µs that takes 200µs and is assigned a backoff timer of 50µs.
• C gets a packet at time 90µs that takes 150µs and is assigned a backoff timer of 150µs.
a) For each of the three hosts, what time do they start sending their packets? You may
ignore the inter-frame spacing and the time required for acks.
A starts sending at time 200µs (it does not hear B) and finishes at 300µs.
B starts sending at 150µs and finishes at 350µs (or 200µs if it hears A’s transmission)
C only decrements its timer before A starts transmitting and once it is finished. Hence, it starts
sending at 350µs and finishes at 500µs
b) Of the three packets sent, which are successfully delivered on the first attempt?
Only the one from C is successfully delivered.

c) For each packet that is not successfully delivered on the first attempt, approximately
when does the sending host learn that the packet was lost and must be sent again?
Hosts learn of lost packets from the absence of ACKs. Here, A would expect an ACK at approximately
300µs and so would learn of the lost packet when the ACK fails to arrive at that time. Similarly, B
would learn of its lost packet at time 350µs.
d) Now, suppose RTS/CTS is enabled. In this case, approximately when does each host
send its data packet? You may assume that the time needed to send RTS, CTS and ACK
packets is negligible.
B sends it RTS at 150µs and gets granted permission to send until 350µs by X.
A sends its RTS at 400µs and gets granted permission to send until 500µs by X.
C sends its RTS at 550µs and gets granted permission to send until 590µs by X.

-7-
7) The diagram below represents a network with the numbers on the edges representing link
costs, and the circles representing routers. The network uses OSPF as its routing protocol.

a) Are any network links never used when sending packets to a host Z connected to router
g? Simply mark these links with an X on the diagram, but explain your reasoning.
Assume that the topology is stable, that the link costs do not change and that g
advertises a route to Z.
The shortest path tree rooted at g basically consists of the branches: (a,c)-b-e-g and d-f-g. Hence, none
of the transversal links a-c, b-d, d-e, and e-f will be used, and neither will the link c-d.

b) Assume that router a sends a new copy of its router LSA. Suppose a copy of this LSA
reaches router e after passing through k other routers. What is the smallest possible
value for k? What is the largest possible value for k? Justify your answers by identifying
the paths the LSA would traverse.
Because LSAs are flooded, the shortest path is basically the minimum hop path, which in the case of
routers a and e would be two hops, i.e., kmin=2. Conversely, the longest possible path that traverses
each router no more than once would be a-c-b-d-f-g-e, for a total of kmax=6. Note that a-b-c-d-f-g-e is
another alternative.

c) Suppose that router e receives n copies of this LSA, all with the same sequence number.
What is the largest possible value for n?
The largest possible value for n is the degree of e, i.e., nmax=4.

-8-
8) Recall that an RSA encryption key is a pair of numbers (n,e) and the corresponding
decryption key is another pair (n,d). Which of the following could be used as RSA key pairs
(ignoring the fact that they are too small)? For those that are valid key pairs, show that they
meet all the requirements for a key pair, for those that are not, explain why they are not.
• (31,5), (31,11)
31 is itself a prime number so that it cannot be the product of two primes. Hence this is not a valid
RSA key pair.

• (301,17), (301,89)
301 is equal to 43*1, so that p=43 and q=7, which are both primes. Hence (p-1)(q-1)=252=
2*2*3*3*7, and e=17 is relatively prime with 252. This implies that (301,17) is a valid RSA
encryption key. Conversely, 89*17=6*252+1, and therefore (301,89) is a valid RSA decryption key.

• (55,7), (55,41)
55 is equal to 11*5, sot that p=11 and q=5, which are both primes. Hence (p-1)(q-1)=40, and e=7 is
relatively prime with 40, so that (55,7) is a valid RSA encryption key. However, 41*7=287 cannot
be expressed in the form k*40+1 (k=7 gives 211 and k=8 gives 361). Hence, (55,41) is not a valid
RSA decryption key.

Consider the RSA key pair (91,11), (91,59). Assume the first is the encryption key and the
second is the decryption key. What is the encrypted value of the number 8?
Hint: 84 mod 91 =1
Note that 91=7*13, so that (p-1)(q-1)=72=2*2*2*7, which is relatively prime with 11, so that (91,11)
is a valid RSA encryption key. Conversely, 59*11=649=9*72+1, so that (91,59) is a valid decryption
key.
The encrypted value of 8 is 811 mod 91 = (84 mod 91)*(84 mod 91)*( 83 mod 91)=57.

-9-
9) Consider the network shown below. AS100 uses OSPF as its internal routing protocol, and
BGP to exchange routes with neighboring ASes. AS100 assigns a LOCAL_PREF value of
100 to all routes learned by routers C and D over their eBGP connection to the “Internet”, a
LOCAL_PREF value of 50 to routes learned by router B over its eBGP connection with AS2,
and a LOCAL_PREF value of 10 to routes learned by router A over its eBGP connection with
AS1. The four routers in AS100, A, B, C, and D, are connected by a full iBGP mesh.

AS3
3.0.0.0/8

AS1 AS2
1.0.0.0/8 2.0.0.0/8

3 B 100.3.0.0/16
100.0.0.0/16 A
AS100 5
9 100.0.0.0/14

C 100.2.0.0/16
100.1.0.0/16 D 1

0.0.0.0/0

Internet

a) Specify the routing table at router A, and for each entry identify the next hop(s) in the
form of either a local connection, or connections to internal routers, or a neighboring AS.
The routing table at A is of the form
0.0.0.0/0: Next hop of B (lowest internal cost of 8 to the Internet)
100.0.0.0/16: Local
100.1.0.0/16: Next hops of B and D (equal cost of 9)
100.2.0.0/16: Next hop of B
100.3.0.0/16: Next hop of B
1.0.0.0/8: Next hop of B (highest LOCAL_PREF)
2.0.0.0/8: Next hop of B (highest LOCAL_PREF)
3.0.0.0/8: Next hop of B (highest LOCAL_PREF)

- 10 -
b) Assume that AS100 wants to ensure that all traffic coming from the “Internet” enters
through router D when destined for subnets 100.0.0.0/16 and 100.1.0.0/16, and
conversely through router C and when destined for subnets 100.2.0.0/16 and
100.3.0.0/16. Similarly, it wants that all traffic coming from ASes 1, 2, and 3 to enter
through router A when destined for subnets 100.0.0.0/16 and 100.1.0.0/16, and
conversely through router B and when destined for subnets 100.2.0.0/16 and
100.3.0.0/16. Identify a mechanism that would guarantee that this happens, while
ensuring that AS100 maintains bidirectional Internet connectivity even if one of its two
connections to the Internet or to ASes 1, 2, and 3 breaks.
The only option that will guarantee the desired outcome is to advertise 100.0.0.0/14 on all eBGP
connections, and the more specific subnets 100.0.0.0/16 and 100.1.0.0/16 on the eBGP connections
from D to the Internet and from A to AS1, and the more specific subnets 100.2.0.0/16 and
100.3.0.0/16 on the eBGP connections from C to the Internet and from B to AS2

c) Assume that AS100 is willing to allow traffic from AS2 and AS3 to transit through it to
reach the Internet. How could AS100 try to realize this, and would it guarantee that its
actions have the exact desired outcome. Justify your answer.
AS100 would advertise a default route to AS2. This would guarantee that all Internet traffic
originating from AS2 knows that it can transit through AS100.
However, this does not ensure that AS3 is also able to do so, and neither does it guarantee that AS1
cannot transit its Internet traffic through AS100. Specifically, enabling AS3 to send its Internet
traffic through AS100 depends on a decision that rests with AS2 and that AS100 cannot control,
namely, having AS2 advertise Internet connectivity (e.g., in the form of a default route) to AS3.
Conversely, if AS2 does advertise a default route to AS3, preventing AS1 from eventually sending its
own Internet traffic through AS100 would require that AS3 not advertise Internet connectivity to
AS3. This is again under the sole purview of AS1 and is not something that AS100 can control.

- 11 -
CSE 473 – Introduction to Computer Networks Roch Guérin
Midterm Exam
Your Name: 10/14/2014

1) (5 points). A user in St. Louis is connected to the Internet via a 4 Mbps (4x106 bits/sec) DSL
link (download speed) and is retrieving a webpage from a server in China. The page is 125
kbytes and contains references to ten (10) images that are each 250 kbytes. The one-way
propagation delay is 50 ms and the DSL link is the bandwidth bottleneck for this connection.
(2 points) Approximately how long does it take for the page (including images) to appear on
the user’s screen, assuming she uses a single persistent HTTP connection to access the server
(queueing and transmission delays on links other than the DSL access link are negligible,
and you can ignore the impact of TCP’s ramp-up)?
Total download time is three RTTs (TCP connection, request of main page, requests for images), plus
the transmission times of the main page and the 10 images, i.e.,
3*(100) ms + (125,000*8 + 10*250,000*8)/(4,000,000) =300 ms + 5.25s = 5.55 seconds

(2 points) How long would it take if the user’s browser used instead two persistent HTTP
connections (the two connections are opened in parallel; one connection is used to request
the page, and the two connections would then each request five images)?
There would be no difference. Each connection incurs a penalty of 3 RTTs, and the total transmission
time on the DSL access link is unchanged.

(1 point) Approximately how big (in bytes) should the buffer at the access router connected
to the user’s DSL link be to ensure there are no packet losses (assume that packets arrive
from the Internet much faster than the 4 Mbps download speed of the DSL link)?
The buffer needs to be able to hold the 10 images arriving from the server (note that the main page
must have been fully transmitted and received by the user’s browser for requests for images to be sent,
and it must therefore have cleared the buffer by the time the images arrive). This translates into a
total buffer space of 10*250 kbytes = 2.5 Mbytes.

-1-
2) (10 points). A private network that uses the 10.1.0.0/16 private address space sits behind a
NAT router (NAT1) that has been allocated the public IP address 45.6.7.1. Assume that a
local host in that network with address 10.1.10.1 is accessing a remote web server with
public address 194.34.45.67. Headers of local packets originating from host 10.1.10.1 and
destined for the web server have the following format in the private network behind NAT1:
<src_addr> <dst_ addr> <src_port> <dest_port>
10.1.10.1 194.34.45.67 4567 80
The NAT (NAT1) already has the following entries:
Internal: <local_addr><local_port> External: <external_port>
<10.1.11.2><4567> <4567>
<10.1.10.1><3333> <3333>
<10.1.10.1><4444> <5555>
(3 points) What is (i) a possible entry in the forwarding table of NAT1 to accommodate the
connection from 10.1.10.1 to web server 194.34.45.67, and (ii) what would then be the
headers of packets from this connection when forwarded by NAT1 into the public Internet?
Because outgoing port <4567> is already in use, the NAT needs to assign a different unused
outgoing port to the connection. A possible new entry in the NAT would be of the form
Internal: <local_addr><local_port> External: <external_port>
<10.1.10.1><4567> <5678>
Correspondingly, the headers of packets forwarded by the NAT in the public Internet would be of the
form
<src_addr> <dst_ addr> <src_port> <dest_port>
45.6.7.1 194.34.45.67 5678 80

(2 points) Assume now that host 10.1.10.1 decides to open a second parallel connection to
the web server. Packet headers for this connection are of the following form in the private
network behind NAT1:
<src_addr> <dst_ addr> <src_port> <dest_port>
10.1.10.1 194.34.45.67 4568 80
Does NAT1 need to create a new entry for this connection, or can it reuse the previous one?
Justify your answer.
Because the connection uses a different port number (4568), the NAT is forced to create a new entry
in its table.

-2-
Host 10.1.10.1 is also engaged in a videoconference with another host in a different private
network behind another NAT (NAT2). The private address of that other host is 10.2.2.2.
Packet headers for the connection from host 10.1.10.1. to host 10.2.2.2 have the following
formats on the internal network of host 10.1.10.1 (internal network 1), in the public Internet,
and in the internal network of host 10.2.2.2 (internal network 2):

Packet headers <src_addr> <dst_ addr> <src_port> <dest_port>


Internal Network 1 10.1.10.1 53.3.4.7 3456 2345
Public Internet 45.6.7.1 53.3.4.7 5889 2345
Internal Network 2 45.6.7.1 10.2.2.2 5889 1345
(3 points) Identify the entries for this connection in the forwarding table of the two NATs?
The corresponding entry in NAT1 is of the form
Internal: <local_addr><local_port> External: <external_port>
<10.1.10.1><3456> <5889>
and conversely, the entry in NAT2 is of the form
Internal: <local _addr><local_port> External: <external_port>
<10.2.2.2><1345> <2345>

(2 points) How would the header of a packet for the return connection (from 10.2.2.2 to
10.1.10.1) look like when traversing the public Internet?
The header of packets for the return connection would be of the following form when traversing the
public Internet
<src_addr> <dst_ addr> <src_port> <dest_port>
53.3.4.7 45.6.7.1 2345 5889

-3-
3) (10 points) Consider a circular DHT with 64 nodes numbered 0, 1,..., 63. Node i handles
keys with hash values in the range ix228 to (i+1)x228-1, and has routes to nodes i+1, i+4, i+8
and i+32 (where addition is modulo 64).
(5 points) What is the maximum number of hops required to get from one server to another
in this DHT?

Each node proceeds greedily jumping to the next node that brings it closest to the target without
overshooting, under the constraint that it can only progress in jumps of 1, 4, 8 or 32 hops. It is easy
to enumerate possible options for this scenario given a client query that originally arrives at node i.

If the key is located in node i+3, 3 one-hop jumps are required to node i+1, i+2 and i+3. If the key is
in node i+7, 4 jumps are required, first to i+4 and then three one-hop jumps as in the previous case.
If the key is in node i+31, the query proceeds to nodes i+8, i+16, i+24, i+28, i+29, i+30 and i+31 for
a total of 7 hops. Finally, if the key is in node i+63, the query proceeds to node i+32, i+40, i+48,
i+56, i+60, i+61, i+62 and i+63 for a total of 8 hops, which is therefore the maximum number of hops
a query will require.

(2 points) Suppose that node 32 receives a get request with a key string of “Led Zeppelin”
that hashes to 8,321,499,137. How many hops will this request go through?
8,321,499,137=(31*228)+1, which implies that the key hashes to a value in the range belonging to
node 31, the immediate predecessor of node 32 that receives the query so that this belongs to the
scenario where the key is in node 31=32+63 mod 64. Hence, according to the reasoning of the
previous question, the query will be resolved in 8 hops.

(3 points) Assume now that nodes can cache key-value pairs. Suppose node 4 cached the
key-value pair for the key “Led Zeppelin” but is the only node to have done so, i.e., the only
other node that has the key-value pair is the node that has the hash value of the key in its
range. Assuming that the next query for key “Led Zeppelin” arrives at a randomly selected
node, what are the odds that node 4 will be handling it, i.e., what are the odds that the next
query for “Led Zeppelin” is handled by node 4?
To answer the question, we need to identify the starting nodes for which node 4 is on the “shortest
path” to node 31. Given that nodes greedily forward the query towards node 31, node 4 is on the path
only if the query originally arrives at either node 4 or node 36. Hence, the odds that node 4 handles
the next query is 2/64 = 0.03125.

-4-
4) (10 points) Two hosts, A and B, are connected by a direct point-to-point link of speed 100
Mbps (108 bits/sec), and rely on a basic go-back-N protocol to ensure reliable transmissions
between them. The link can lose/corrupt packets, but not reorder them. A and B use 1,250
bytes packets, including header and payload, and as usual the protocol uses a single shared
timer. The window size is 61 packets.
(3 points) What is the maximum possible RTT between A and B that will allow
communication at the maximum rate of 100 Mbps in the absence of packet errors or losses?
For simplicity, assume that the RTT measures the time between the transmission of the last
bit of a packet until the ACK for that packet is received.
It takes 60*1,250*8/108 = 6 ms to transmit the sixty 1,000 bytes packets (packets 2 to 61) allowed
after the transmission of packet 1. In order for transmission to be able to continue uninterrupted, the
ACK for packet 1 must, therefore, have been received by that time. Hence, 6 ms is the maximum RTT
that the connection can tolerate and still be able to communicate at 100 Mbps in the absence of packet
errors or losses.

(4 points) Assume from now on an RTT of 10 ms (5 ms each way) and a time-out value of 11
ms. Consider a scenario where at time t = 0, A starts transmitting packets 1 to 50, packet 1 is
lost, so that A eventually retransmits packets 1 to 50. Packet 50 is then lost during this
retransmission. When will packet 50 be eventually received at B (assume that no ACKs are
lost)?
The loss of packet 1 is detected at t = 11 ms because of a time-out. This triggers the retransmission of
all 50 packets. The ACKs for packets 1 to 49 arrive 10 ms after A transmits their last bit and are each
0.1 ms apart. Hence, the ACK for packet 49 arrives at t=11+10+49*0.1=25.9 ms. The receipt of the
ACK for packet 49 restarts the time-out timer that will, therefore, expire 11 ms later at t=36.9 ms.
This triggers the retransmission of packet 50 with the packet’s last bit leaving A at time t=37 ms to
finally arrive at B 5 ms later at t = 42 ms.

(3 points) Assume next that at time t the state at A is as follows: sendBase = 25, nextSeqNum
= 63, timerExpiration = 5 ms, where sendBase is the sequence number of the oldest
unacknowledged packet, nextSeqNum is the sequence number to be used in the next packet
transmission, and timerExpiration tracks how much time is left before the time-out timer
expires. An ACK with sequence number 32 is received at t + 1 ms, and at t + 7 ms the
application at A writes five (5) packets worth of new payload. What is the state at A, i.e.,
values of sendBase, nextSeqNum, and timerExpiration, at time t + 9 ms, and what packets
are still in A’s re-send buffer?
The receipt of an ACK with sequence number 32 at t + 1 ms shifts sendBase to 33 and restarts the
time-out timer, so that its value is now timerExpiration = 11 ms. Given that the window size is 60
and that sendBase = 33, the legal sendWindow of A extends from sequence number 33 to sequence
number 92. Since nextSeqNum is 63, A is able to send another 30 packets, which is sufficient to
allow it to transmit the five packets needed to carry the new payload written by the application.
Hence at time t + 9 ms, the state at A is as follows: sendBase = 33, nextSeqNum = 68, and
timerExpiration = 3 ms.
Additionally, packets 33 to 67 are still in A’s resend buffer.

-5-
5) (15 points) Consider a TCP sender that sends MSS size packets with MSS = 1000 bytes. The
sender needs to upload a file whose size corresponds to the aggregate payload of a total of
2048 MSS size packets. The sender starts packet transmissions at t = 0 (after the TCP
handshakes completes) with ssthresh = rcvWindow = 64 MSS. The sender is connected to the
Internet through a 10 Gbps (1010 bits/sec) link, but the bottleneck link on the connection’s
path is 100 Mbps (108 bits/sec). The connection’s RTT is mostly constant at 40 ms, i.e.,
EstimatedRTT ≈ 40 ms and DevRTT ≈ 0 ms. Assume that the TCP connection does not use
delayed ACKs.
(5 points) How long approximately will it take the sender to upload half the file, i.e.,
transmit 1024 MSS size packets, in the absence of packet losses?
The sender enters slow-start with cwnd = 1 MSS at t = 0, and the slow-start period lasts until cwnd
= ssthresh with cwnd increasing by one packet for each ACK received. cwnd therefore increases as
follows during successive cycles of duration 1 RTT each: 1, 2, 4, 8, 16, 32, 64. Hence, the sender
exits slow-start approximately six (6) RTTs later, and during that time transmitted 127 packets. It
subsequently transmits 64 MSS size packets in each RTT. As a result, after 20 RTTs it will have
transmitted 127+14*64 = 1023 MSS size packets. The sender receives another ACK at the start of the
21st RTT cycle, at which point it is able to transmit the 1024th packet. So it takes approximately 20
RTTs (plus one packet transmission time) or 800 ms for the sender to upload half the file.
(6 points) The sender uses TCP Reno. Assume that the connection experienced no losses
until packet number 1984 that is lost at time t. At that time, cwnd had long reached it
maximum value. How long approximately will it take from t onward before the sender
knows that the entire file has been successfully uploaded to the receiver, i.e., receives an
ACK acknowledging the last packet? For simplicity, assume that the lost packet 1984 is the
first to be transmitted in a new batch (window) of cwnd packets sent by the sender.
Packet 1984 is actually the first packet to be transmitted in the 36th RTT of the connection. Because
packet 1984 is lost, the receiver will generate duplicate ACKs when receiving packets 1985, 1986, and
1987. The sender receives them approximately one RTT after transmitting packet 1984 (one RTT
plus three packet transmissions). This then triggers the retransmission of packet 1984 and the sender
enters fast recovery. Fast recovery will last for about one RTT (until the receipt of the retransmitted
packet 1984 is acked) during which time the sender will be able to send an additional 31 packets
beyond those that were sent in the same RTT as packet 1984, i.e., packet 1985 to 2047. Since the file
only requires 2048 packets, the sender only needs to send one more packet in addition to
retransmitting packet 1984. Duplicate ACKs triggered by packets 1985 to 2047 arrive spaced 80
μsecs apart. The sender can transmit a new packet when the duplicate ACK for packet 1984 + 32 =
2016 arrives, i.e., after 2.56 ms. Hence, the ACK for this last packet arrives 2.56 ms after the ACK
for the retransmitted packet 1984. So it takes approximately two (2) RTTs + 2.56 ms, i.e., 82.56 ms,
after the loss occurred for the sender to know that the entire file has been successfully uploaded to the
receiver.
(4 points) Assume next that the sender is using TCP Tahoe instead of TCP Reno. How does
this change the answer?
The main difference between TCP Tahoe and Reno is that Tahoe does not implement fast recovery,
i.e., it enters slow-start after detecting a loss. This adds one RTT to the transmission of the next
packet after the retransmitted packet (the ACK for the retransmitted packet acknowledges all packets
up to packet 2047 and allows the transmission of packet 2048, whose ACK is then received one RTT
later), i.e., the sender knows that the file has been fully received 120 ms after the loss occurred.

-6-
6) (15 points) A sender uses TCP Reno (without delayed ACKs) with cwnd = rcvWindow = 64
kbytes (216 bytes), an MSS of 1 kbytes (210 bytes), an RTT of 104.858 ms, and is transmitting
over a path with a bottleneck link of speed 10 Mbps (107 bits/sec). The router connected to
that link has a very small buffer, so that it will lose packets as soon as the aggregate
incoming transmission rate barely exceeds the link capacity.
(5 points) How many parallel connections can the sender safely open to increase its
aggregate transmission rate without incurring losses at the bottleneck link? You can assume
that the receiver has enough memory to allocate a rcvBuffer of 64 kbytes to each new
connection.
Assuming cwnd = 64 kbytes and RTT = 104.858 ms, each connection has as rate of 216*8/0.104858 =
5 Mbits/sec. Hence, the sender can open two parallel connections to realize an aggregate
transmission rate of 10 Mbits/sec without incurring losses.

(10 points) Assume that the sender decides to open 4 parallel connections. What will
approximately be the steady-state aggregate transmission rate it manages to realize? Note
that if connections experience losses, you need to identify what their overall rate would be,
accounting for the up and down pattern of transmission rate the connection would
experience
The maximum possible rate that each connection can realize without causing losses is 2.5 Mbits/sec,
which correspond to cwnd = 32 kbytes, which they will therefore repeatedly exceed. Since all
connections have the same RTT, TCP’s fairness property ensures that in steady state the 4
connections achieve the same rate, and alternate through similar patterns of rate increase followed by
losses and consequently rate decrease. Since losses occur as soon as the aggregate rate exceeds 10
Mbits/sec, this implies that when each connection just exceeds 2.5 Mbits/sec, it experiences a loss and
drops back to half that rate, i.e., cwnd = 16 kbytes. Since the sender is using TCP Reno, the
connections do not enter slow-start and progressively increase their rate back up. It takes each
connection approximately 16 RTTs to increase their cwnd back up to 32 kbytes, at which point, i.e.,
in the next RTT, losses occur again and the cycle repeats.
During one cycle of duration 17 RTTs, each connection transmits 16+17+18+…+31+32+32 =440
MSS or 3,604,480 bits over a period of 18*104.858 ms = 1.887 secs, or a throughput of just under 2
Mbits/sec (1.909 Mbits/sec). This translates into an aggregate throughput of about 7.639 Mbits/sec,
which is below the maximum possible rate the sender could have achieved by opening fewer
connections.

-7-
CSE 473 – Introduction to Computer Networks John DeHart
Midterm Exam Review Solution
10/12/2015

1. (5 points). A user in Chicago, connected to the internet via a 100 Mb/s (b=bits) connection
retrieves a 250 KB (B=bytes) web page from a server in London, where the page references
three images of 500 KB each. Assume that the one way propagation delay is 75 ms and that
the user’s access link is the bandwidth bottleneck for this connection.
Approximately how long does it take for the page (including images) to appear on the user’s
screen, assuming non-persistent HTTP using a single connection at a time (for this part, you
should ignore queueing delay and transmission delays at other links in the network)?
With non-persistent HTTP, there is one TCP connection for the page and one for each one of the
images. Each connection incurs a delay of 2*RTT plus transmission time. Hence the total time until
the page+images shows up on the user’s screen is calculated as follows:
RTT = 2 * 75ms = 150ms
Transmission Time = (Amount of data)/(data rate) =
((250 Kbytes * 8 bits/byte) + (3 * 500 Kbytes * 8 bits/byte))/(100 x 10Mbits/sec)=
( 2 Mbits + 3 * 4 Mbits) / (100 Mbits/s)
(#RTT)*(RTT) + (Transmission Time)
2*(3+1) * 150 ms + (14 Mb)/(100 Mb/s) =
8 * 150ms + (14 * 106 bits)/100 * 106 b/sec =
1200 ms + 0.14 sec =
1200 ms + 140 ms = 1.34 seconds

How long does it take if the connection uses persistent HTTP (single connection)?
With persistent HTTP, there is only one TCP connection. The TCP connection handshake takes one
RTT, this is followed by one more RTT to request the page, one more RTT to request the images, plus
the transmission time for the page+images. Hence the total time for the page+images to show up on
the user’s screen is equal to, 3 RTTs plus transmission time which is:
3*(2*75 ms) + 140 ms = 450 ms + 140 ms = 590 ms

Suppose that user’s access router has a 4 MB buffer (B=byte) on the link from the router to
the user. How much delay does this buffer add during periods when the buffer is full?
W=E[N] x E[L] / c, E[N] x E[L] = 4MB = 32*106 bits, c = 100 Mb/s = 108 b/s
So it adds: 32*106 bits/108 bits/sec=320 ms to the delay.

-1-
2. (10 points). Consider a circular DHT with 27 nodes numbered 0, 1,...,26, where the nodes
cache key-values pairs for 60 seconds before discarding them. Assume that each node i
handles keys with hash values in the range 100i to 100i+99. Also, assume that node i has
routes to nodes i+1, i+3 and i+9 (where the additions are modulo 27). What is the maximum
number of hops required to get from one server to another in this DHT?

Each step moves you closer to the target by 1, 3 or 9 hops. One can readily see that the maximum
number of hops is realized when the key is at the maximum possible distance, i.e., 26 nodes. Given
this and because 26=9+9+3+3+1+1, the maximum number of hops is 6.

Suppose that some client sends a get request to node 20 with a key string of “candy corn”,
and that hash(“candy corn”)=1853. If the request is handled by exactly 4 nodes in the DHT
(including 20), which nodes are they?
The key hashes in the range that belongs to node 18. So node 20 will forward the request to the node
that takes it closest to node 18, i.e., using 9 hop route that takes it to node 20+9=2 (mod 27). Node 2
goes through the same process and uses a 9-hop route to reach node 2+9=11. Node 11 cannot use a 9-
hop route since it would take it too far, and must therefore use a 3-hop route that takes it to node
11+3=14, which since this is the 4th node is where the query ends (node 14 must have previously
cached the entry for hash(“candy corn”)). So, the four nodes are 20, 2, 11 and 14.

Suppose node 13 has an entry for “candy corn” in its cache but no other nodes do. Now
assume that every other node receives a get request for “candy corn”. How many of these
requests does 13 handle? (Ignore any new cache entries that might be created in the process
of handling these requests.)
Node 13 will handle the request if it is on the shortest path between the node where the request
arrived and node 18. This holds whenever the request first arrived at node 13, 10, 4, 1, 22 or 19. So,
node 13 will handle 5 requests from other nodes, plus one more if you include the request sent to 13.

Repeat your answer to the last question assuming that node 2 has the cached entry for
“candy corn”. (That is, how many of the requests would 2 handle in this case?)
Node 2 would only handle requests that arrive at node 2 or node 20. So 1 request from other nodes,
plus the one sent to 2.
If you need to, list each node and the node it will send to to try to get to the node responsible for 1853:
0 à 9 7 à 16 14 à 17 21 à 3
1 à 10 8 à 17 15 à 18 22 à 4
2 à 11 9 à 18 16 à 17 23 à 5
3 à 12 10 à 13 17 à 18 24 à 6
4 à 13 11 à 14 18 à 25 à 7
5 à 14 12 à 15 19 à 1 26 à 8
6 à 15 13 à 16 20 à 2
Bold for nodes leading to 13, underline for nodes leading to 2

-2-
3. (10 points) The diagram below shows a DNS query from a host A to its local DNS server.
The IP addresses of all hosts are shown in the diagram. The label “Q(web.foo.edu)” specifies
the query string. Complete the diagram showing all packets sent to resolve the name and
continuing through the opening of a TCP connection to the web site and the first GET
request. All arrows that represent DNS queries should have a label of the form “Q(a.b.edu)”
and replies should have a label of the form “R(b.edu=2.3.7.11)”. TCP connection packets
should be labeled with the appropriate flags and HTTP packets with the request type.
Assume that the local DNS server performs recursive processing and has nothing in its
cache, while the others perform iterative processing. You may assume that all queries and
responses are for A records.

List all the mappings in the local DNS server’s cache after the query has been processed.

Remember, “recursive processing” means the local server is processing a recursive query and will
send out iterative queries. All other servers will get and send iterative queries.

.edu=>1.2.3.4, foo.edu=>2.3.4.5, web.foo.edu=>2.3.4.13

List the mappings in the local DNS server’s cache if the .edu server did recursive processing
rather than iterative.

.edu=>1.2.3.4, web.foo.edu=>2.3.4.13

-3-
4. (15 points). The diagram below shows two residential networks with routers that implement
NAT and a remote server with a public internet address

internal external internal external


(IP,Port) port E (IP,Port) port
10.1.1.1, 5555 8888 4.3.2.1 10.1.1.4, 1212 5454
10.1.1.2, 6565 7878

NATs

A B C D

10.1.1.1 10.1.1.2 10.1.1.3 10.1.1.4


The packet header diagrams at right are for a packet from a host in the left-hand network,
going to the server. The first shows the header
when the packet arrives at the router, the second src adr dest adr src port dest port
shows it when the packet leaves the router. Add an 10.1.1.1 4.3.2.1 5555 3333
entry to the left-hand NAT table that is consistent
with these two packet headers. What is the public
3.7.5.7 4.3.2.1 8888 3333
IP address of the left-hand router?
Public IP address of left-hand NAT router is 3.7.5.7
The three header diagrams at right are for a packet src adr dest adr src port dest port
from a host in the right-hand network, going to a
10.1.1.4 3.7.5.7 1212 7878
host in the left-hand network. Fill in the blank
fields. Add entries to the two NAT tables that are
consistent with this sequence of packet headers. 5.3.5.2 3.7.5.7 5454 7878
What is the public IP address of the right-hand
router? 5.3.5.2 10.1.1.2 5454 6565
Public IP address of right-hand NAT router is 5.3.5.2
In the diagrams at right, fill in the
header fields that would be used by a src adr dest adr src port dest port
response to the last packet, (the 10.1.1.2 5.3.5.2 6565 5454
response goes from the left hand
network to the right).
3.7.5.7 5.3.5.2 7878 5454

3.7.5.7 10.1.1.4 7878 1212

-4-
5. (10 points) The diagram at left below shows the state of the sending side of a
communication session using a go-back-N protocol with cumulative acknowledgements, a
window size of 4 and a retransmission timeout of 25. The array represents the “re-send”
buffer and entry in the buffer represents a packet with its sequence number. As usual for go-
back-N, we are using a single shared timer. Its expiration time is shown in the diagram.
Assume that the channel may lose packets but never re-orders them.

Suppose that at time 7, the application passes us a new payload to be sent, and at time 12 we
receive an ack with sequence number 3.
List all the packets sent by the sender between times 6 and 13, including repeats (if any).
p5, p2, p3, p4, p5

Show the state of the sender at time 13, in the right-hand diagram.
See above
At time 13, how many additional packets can be sent before an ack is received?
2

-5-
6. (10 points) Consider a TCP sender that sends 10 bytes A B
per packet. Suppose that the sender transmits six 10
packets one right after another (including the one
20
shown at right). Show the packets and the
corresponding acks that TCP would return in a typical 30
situation. Label the data packets with the sequence
number and the ack packets with the ack number. 40
If the second of the acks is lost, will the sender 50
retransmit any packets? Why or why not? 30
60
No, because the next cumulative ack lets the sender know 50
that the corresponding packet was delivered.

Continuing the example, suppose that the next two


packets sent arrive out of order and that the sender
70
transmits four more packets after these and that the 70
second packet in this group of four is lost. Extend the
diagram to show these packets and the resulting
80
acknowledgements. You need not show the
retransmission of the lost packet. 70
90

90
100
110
120

100

100

-6-
7. (10 points) The diagram at right shows two TCP
R1
senders at left and the corresponding receivers at S1 100 ms
right. Both senders use TCP Tahoe. Assume that
the MSS is 1 KB, that the one-way propagation
delay for both connections is 100 ms and that the R2
S2 16 Mb/s
link joining the two routers has a bandwidth of 16
Mb/s. Let cwnd1 and cwnd2 be the values of the
senders’ congestion windows. What is the smallest value of cwnd1+cwnd2 for which the link
joining the two routers stays busy all the time?
16 Mb/s is 2 MB/s or 400 KB per RTT. So cwnd1+cwnd2 =400 KB is the smallest amount that keeps
the link busy.

Assume that the link buffer overflows whenever cwnd1+cwnd2≥600 KB and that at time 0,
cwnd1=500 KB and cwnd2=100 KB. Approximately, what are the values of cwnd1 and cwnd2
one RTT later? Assume that all losses are detected by triple duplicate ACKs.
They are both set to 1kB, i.e., one MSS, since with TCP Tahoe the connection goes back to slow-start
after a loss.

At this point, what are the values of ssthresh1 and ssthresh2?


ssthresh1=250 KB and ssthresh2=50 KB

After 20 more RTTs, approximately what are the values of cwnd1 and cwnd2?
After 8 RTTs cwnd1 is about 250 KB, so after 20, it is about 262 KB. After 6 RTTs cwnd2 is about 50
KB, so after 20, it is about 64 KB.

Approximately, how many more RTTs before cwnd1+cwnd2≥600 KB again?


262+64=326, so it will take (600–326)/2 = 274/2 = 137 RTTs before cwnd1+cwnd2≥600 KB again.

-7-
5) Consider a residential network that connects to the internet via a 4 Mb/s DSL link. Assume
that three UDP flows share the link, each sending at rates of 1 Mb/s, 2 Mb/s and 3 Mb/s.
Assume that the ISP router has a link buffer that can hold 300 packets (assume all packets
have the same length). For each flow, what fraction of the packets it sends is discarded?
Assuming a single shared queue, each flow gets a fraction of the 4 Mb/s bandwidth that is
proportional to its transmission rate compared to the aggregate input rate. In other words, the 1
Mb/s flow gets a bandwidth of about 2/3 Mb/s, the 2 Mb/s flow gets a bandwidth of about 4/3 Mb/s
and the 3 Mb/s flow gets a bandwidth of about 2 Mb/s. Hence, each flow loses about 33% of the
packets they send.

a) How many packets does each flow approximately have in the queue?
The number of packets that each flow has in the queue is proportional to the fraction of the output
bandwidth it gets. Hence, the first flow has about 50 packets in the queue, the second flow has about
100 packets, and the third flow has about 150 packets.

b) Now, suppose the queue at the ISP router is replaced by three queues that can each hold
100 packets and that the queues are scheduled using weighted-fair queueing, where the
weights are all 0.33. In this case, what fraction of packets are discarded from each flow?
In this case, the first flow loses 0% of its packets (the first flow consumes a share of the bandwidth
equal to min(1Mb/s, 4/3 Mb/s)=1Mb/s). The second and third flows equally share the remaining 3
Mb/s of bandwidth, and therefore each get 1.5 Mb/s. Hence, the second flow loses 25% of its packets,
and the third flow loses 50% of its packets.

c) In this configuration, how many packets does each flow have in its queue?
The first flow’s queue is empty or close to empty. The other two flows each have about the maximum
number of 100 packets in their queues.

d) Now, suppose the weights are 0.2 for the first flow, 0.6 for the second and 0.2 for the
third. In this case, what fraction of packets is discarded from each flow?
In this configuration, the second flow consumes a bandwidth share of min(2Mb/s, 0.6*4
Mb/s)=2Mb/s, and the first and third flows equally share the remaining 2 Mb/s ,i.e., each get 1 Mb/s.
As a result, and assuming a 100 packets queue, the first flow should lose close to 0%, though this
depends on how packets arrive, and it could even experience some losses. The third flow loses
approximately 67% of its packets.
e) How many packets does each flow approximately have in its queue?
The second flow’s queue is empty or close to empty. The third flow’s queue is about full with about
100 packets.
As alluded to above, because the first flow is allocated a fraction of the link bandwidth that exactly
matches its data rate, the queue load is 1. If packets arrive regularly, the queue will remain mostly
empty, but if arrivals are highly bursty, significant queueing and losses could occur. For a single
flow however, it’s more likely that the queue will never accumulate a large backlog.

-7-
6) (10 points) The diagram at right shows a WIFI network with an access
point, X and three hosts, A, B and C. The large circles indicate the
coverage areas of the three hosts. The coverage area for X is not shown, B
but you may assume that it includes all three hosts. Assume RTS/CTS
are not used. A X

Suppose X is transmitting a packet at time 0 and finishes sending it at


C
time 100s. Also,
 A gets a packet to send at time 50 that takes 100s to send and is
assigned a backoff timer of 100s.
 B gets a packet at time 70s that takes 200s and is assigned a backoff timer of 50s.
 C gets a packet at time 90s that takes 150s and is assigned a backoff timer of 150s.
a) For each of the three hosts, what time do they start sending their packets? You may
ignore the inter-frame spacing and the time required for acks.
A starts sending at time 200s (it does not hear B) and finishes at 300s.
B starts sending at 150s and finishes at 350s (or 200s if it hears A’s transmission)
C only decrements its timer before A starts transmitting and once it is finished. Hence, it starts
sending at 350s and finishes at 500s
b) Of the three packets sent, which are successfully delivered on the first attempt?
Only the one from C is successfully delivered.

c) For each packet that is not successfully delivered on the first attempt, approximately
when does the sending host learn that the packet was lost and must be sent again?
Hosts learn of lost packets from the absence of ACKs. Here, A would expect an ACK at approximately
300s and so would learn of the lost packet when the ACK fails to arrive at that time. Similarly, B
would learn of its lost packet at time 350s.
d) Now, suppose RTS/CTS is enabled. In this case, approximately when does each host
send its data packet? You may assume that the time needed to send RTS, CTS and ACK
packets is negligible.
B sends it RTS at 150s and gets granted permission to send until 350s by X.
A sends its RTS at 400s and gets granted permission to send until 500s by X.
C sends its RTS at 550s and gets granted permission to send until 700s by X.

-8-
7) The diagram below represents a network with the numbers on the edges representing link
costs, and the circles representing routers. The network uses OSPF as its routing protocol.

b 1
4 e 4
a 6 g
5 6
3
2 3
f
c d 2
4
a) Are any network links never used when sending packets to a host Z connected to router
g? Simply mark these links with an X on the diagram, but explain your reasoning.
Assume that the topology is stable, that the link costs do not change and that g
advertises a route to Z.
The shortest path tree rooted at g basically consists of the branches: (a,c)-b-e-g and d-f-g. Hence, none
of the transversal links a-c, b-d, d-e, and e-f will be used, and neither will the link c-d.

b) Assume that router a sends a new copy of its router LSA. Suppose a copy of this LSA
reaches router e after passing through k other routers. What is the smallest possible
value for k? What is the largest possible value for k? Justify your answers by identifying
the paths the LSA would traverse.
Because LSAs are flooded, the shortest path is basically the minimum hop path, which in the case of
routers a and e would be two hops, i.e., kmin=2. Conversely, the longest possible path that traverses
each router no more than once would be a-c-b-d-f-g-e, for a total of kmax=6. Note that a-b-c-d-f-g-e is
another alternative.

c) Suppose that router e receives n copies of this LSA, all with the same sequence number.
What is the largest possible value for n?
The largest possible value for n is the degree of e, i.e., nmax=4.

-9-
8) Recall that an RSA encryption key is a pair of numbers (n,e) and the corresponding
decryption key is another pair (n,d). Which of the following could be used as RSA key pairs
(ignoring the fact that they are too small)? For those that are valid key pairs, show that they
meet all the requirements for a key pair, for those that are not, explain why they are not.
 (31,5), (31,11)
31 is itself a prime number so that it cannot be the product of two primes. Hence this is not a valid
RSA key pair.

 (301,17), (301,89)
301 is equal to 43*1, so that p=43 and q=7, which are both primes. Hence (p-1)(q-1)=252=
2*2*3*3*7, and e=17 is relatively prime with 252. This implies that (301,17) is a valid RSA
encryption key. Conversely, 89*17=6*252+1, and therefore (301,89) is a valid RSA decryption key.

 (55,7), (55,41)
55 is equal to 11*5, sot that p=11 and q=5, which are both primes. Hence (p-1)(q-1)=40, and e=7 is
relatively prime with 40, so that (55,7) is a valid RSA encryption key. However, 41*7=287 cannot
be expressed in the form k*40+1 (k=7 gives 211 and k=8 gives 361). Hence, (55,41) is not a valid
RSA decryption key.

Consider the RSA key pair (91,11), (91,59). Assume the first is the encryption key and the
second is the decryption key. What is the encrypted value of the number 8?
Hint: 84 mod 91 =1
Note that 91=7*13, so that (p-1)(q-1)=72=2*2*2*7, which is relatively prime with 11, so that (91,11)
is a valid RSA encryption key. Conversely, 59*11=649=9*72+1, so that (91,59) is a valid decryption
key.
The encrypted value of 8 is 811 mod 91 = (84 mod 91)*(84 mod 91)*( 83 mod 91)=57.

- 10 -
9) Consider the network shown below. AS100 uses OSPF as its internal routing protocol, and
BGP to exchange routes with neighboring ASes. AS100 assigns a LOCAL_PREF value of
100 to all routes learned by routers C and D over their eBGP connection to the “Internet”, a
LOCAL_PREF value of 50 to routes learned by router B over its eBGP connection with AS2,
and a LOCAL_PREF value of 10 to routes learned by router A over its eBGP connection with
AS1. The four routers in AS100, A, B, C, and D, are connected by a full iBGP mesh.

AS3
3.0.0.0/8

AS1 AS2
1.0.0.0/8 2.0.0.0/8

3 100.3.0.0/16
B
100.0.0.0/16 A
AS100 5
9 100.0.0.0/14

C 100.2.0.0/16
100.1.0.0/16 D 1

0.0.0.0/0

Internet

a) Specify the routing table at router A, and for each entry identify the next hop(s) in the
form of either a local connection, or connections to internal routers, or a neighboring AS.
The routing table at A is of the form
0.0.0.0/0: Next hop of B (lowest internal cost of 8 to the Internet)
100.0.0.0/16: Local
100.1.0.0/16: Next hops of B and D (equal cost of 9)
100.2.0.0/16: Next hop of B
100.3.0.0/16: Next hop of B
1.0.0.0/8: Next hop of B (highest LOCAL_PREF)
2.0.0.0/8: Next hop of B (highest LOCAL_PREF)
3.0.0.0/8: Next hop of B (highest LOCAL_PREF)

- 11 -
b) Assume that AS100 wants to ensure that all traffic coming from the “Internet” enters
through router D when destined for subnets 100.0.0.0/16 and 100.1.0.0/16, and
conversely through router C and when destined for subnets 100.2.0.0/16 and
100.3.0.0/16. Similarly, it wants that all traffic coming from ASes 1, 2, and 3 to enter
through router A when destined for subnets 100.0.0.0/16 and 100.1.0.0/16, and
conversely through router B and when destined for subnets 100.2.0.0/16 and
100.3.0.0/16. Identify a mechanism that would guarantee that this happens, while
ensuring that AS100 maintains bidirectional Internet connectivity even if one of its two
connections to the Internet or to ASes 1, 2, and 3 breaks.
The only option that will guarantee the desired outcome is to advertise 100.0.0.0/14 on all eBGP
connections, and the more specific subnets 100.0.0.0/16 and 100.1.0.0/16 on the eBGP connections
from D to the Internet and from A to AS1, and the more specific subnets 100.2.0.0/16 and
100.3.0.0/16 on the eBGP connections from C to the Internet and from B to AS2

c) Assume that AS100 is willing to allow traffic from AS2 and AS3 to transit through it to
reach the Internet. How could AS100 try to realize this, and would it guarantee that its
actions have the exact desired outcome. Justify your answer.
AS100 would advertise a default route to AS2. This would guarantee that all Internet traffic
originating from AS2 knows that it can transit through AS100.
However, this does not ensure that AS3 is also able to do so, and neither does it guarantee that AS1
cannot transit its Internet traffic through AS100. Specifically, enabling AS3 to send its Internet
traffic through AS100 depends on a decision that rests with AS2 and that AS100 cannot control,
namely, having AS2 advertise Internet connectivity (e.g., in the form of a default route) to AS3.
Conversely, if AS2 does advertise a default route to AS3, preventing AS1 from eventually sending its
own Internet traffic through AS100 would require that AS3 not advertise Internet connectivity to
AS3. This is again under the sole purview of AS1 and is not something that AS100 can control.

- 12 -
CSE 473S – Introduction to Computer Networks Roch Guérin
Final Exam
Your Name: 12/20/2017

Six (6) Problems for a total of 120 points and a max of 100 points
(No points for answers without explanations/justifications)
1) [25 points] Consider an Ethernet network that consists of 9 switches, A to I, as shown below.

A B C

D E F

G H I

The little “clouds” correspond to local LAN segments, i.e., LAN segments to which hosts are
attached. Local LAN segments run at 10Gbps, while links between switches are 1Gbps links.
a. [10 points] Assume that switch priority is in decreasing alphabetical order, i.e., switch A has
the highest priority and switch I the lowest. Draw the resulting spanning tree, and for each
switch indicate its root port (RP), designated port(s) (DP) and blocked port(s) (BP), if any.

DP
DP DP RP DP RP DP
A B C
DP DP DP
RP RP DP RP
DP DP
DP DP
D E F
DP DP DP
RP RP RP
DP DP DP DP
G H I
DP

The spanning tree and port types at each bridge are identified in the above diagram, with switch
A as the root bridge.
b. [5 points] Under the same switch priority assignments as in the previous question and
assuming that switches transmit BPDUs every 100ms, how long would it take for the
spanning tree to be constructed if all the switches were powered on at the same time? Justify
your answer.
In each 100ms cycle, a switch learns about switches that are one hop further away. Since all the
links have the same bandwidth, the shortest path between any two switches is the minimum hop
path. The maximum hop count of the shortest path between any switch and switch A, the eventual
root bridge, is 4, i.e., between switch A and I. This implies that the spanning tree will be finalized
after 400ms or 4 cycles, as this is how long it takes for switch I to discover the root bridge A and
its shortest path to it. All other switches take less time.

-2-
c. [5 points] Assume that servers are connected to local LAN segments attached to switches C,
F, and I, with hosts on local LAN segment attached to switches A, D, G having heavy traffic
to/from the server attached to switches C, F, and I, respectively, e.g., hosts attached to switch
A have heavy traffic to the server attached to switch C. Identify an assignment of priorities to
switches that would ensure that traffic between hosts and their respective servers can flow on
the most direct paths on the resulting spanning tree. JUSTIFY YOUR ANSWER, e.g.,
identify the corresponding spanning tree and switch priorities, and why it results in the most
direct paths.
The most direct paths between hosts and servers are A-B-C; D-E-F; G-H-I. In order to ensure
that traffic flows on those paths, they need to be on the spanning tree. One (out of many) possible
option is a spanning tree of the form shown below

A B C

D E F

G H I

This can be realized by assigning the following priorities to switches (smaller is higher):
E: 1; B: 2; H: 3; and the other priorities are irrelevant, as long as they are lower than 3.
d. [5 points] Considering again the Ethernet network of question a, what is the maximum total
traffic volume that this network could ever carry, and what traffic pattern does it correspond
to, i.e., identify the locations and traffic intensities of traffic source and sink hosts for a
configuration that achieves this maximum traffic volume?
The maximum possible traffic volume is 8Gbps, since the spanning tree has a total of 8 switch
links, each with a capacity of 1Gbps. This can be realized by having hosts attached to the local
segment of a given switch send 1Gbps worth of traffic to hosts on the local LAN segment of a
neighbor switch on the spanning tree. Note that because local LAN segments run at 10Gbps, they
can source/sink traffic to/from multiple switch links. Assuming the spanning tree of question 1, a
possible realization is as follows:
A->B; A->D; D->G; B->E; E->H; C->B; C->F; F->I.

-3-
2) [10 points] The network administrator of an office building has been allocated the following
seven (7) subnets by its service provider:
(a) 192.166.10.0/25 (b) 192.166.10.129/25 (c) 192.166.11.0/24

(d) 192.166.12.0/22 (e) 192.166.8.0/24 (f) 192.166.9.0/24

(g) 192.166.16.0/21

What is the smallest number of prefixes that the network administrator needs to advertise to the
outside world to properly announce reachability to all its users, but no other? Explicitly identify
the required prefixes in support of your answer.

The bit patterns for the last two bytes of the seven subnets that have been allocated to the network
administrator are as follows:

(a). 00001010.0*******,
(b). 00001010.1******* (with a mask size of 25, 129 is equivalent to 128)
(c). 00001011.********
(d). 000011**.********
(e). 00001000.********
(f). 00001001.********
(g). 00010***.********

(a) and (b) can be combined into 192.166.10.0/24, which can then be combined with (c) to yield
192.166.10.0/23. Similarly, (e) and (f) can be combined to produce 192.166.8.0/23. The two /23
prefixes obtained from these aggregation steps can be in turn combined into 192.166.8.0/22,
which together with (d) produces the supernet 192.166.8.0/21. This supernet can unfortunately
not be combined with the remaining supernet 192.166.16.0/21, so that our network administrator
needs to advertise the two /21 prefixes to ensure that it properly announces reachability to all its
users.

-4-
3) [25 points] Consider three traffic sources, A, B, and C (see below), that are feeding a common
multiplexer M connected to a shared 100 Mbps link. All three sources generate fixed size, 10,000
bits packets according to the patterns described in Table 1, with the first packet arriving at M at
t=0. There is no packet processing delay in M, so that any delay that packets experience is caused
by queueing delays waiting for the transmission of other packets.

A
100 Mbps
B M
C

Source Packet generation times (in units of 100secs)


A A1=0, A2=1, A3=2, A4=4, A5=5
B B1=0, B2=2, B3=3, B4=4, B5=5, B6=6, B7=7, B8=8
C C1=2.5, C2=5.5, C3=8.5

Table 1: Packet arrival times

a. [10 points] Assume that the queueing discipline for the Ethernet link at M is FIFO, and that
packets that arrive at the same time are inserted in the FIFO queue in the alphabetical order of
their respective source, e.g, if packets from sources A, B, and C arrive together, A will be inserted
first in the FIFO queue, followed by B, and then C. What is the maximum delay (time between
the packet arrival and when it starts transmission on the link) experienced by any packet across all
three sources? Justify your answer by showing how you compute this maximum delay value.

The 100Mbps link is capable of transmitting one 10,000 bits packet every 100secs. If we track
packet arrivals and departures at M after time 0, we see that the link remains always busy until
the last one of the packets listed in Table 1 has been transmitted. This is because at any point in
time during that period, more bits have arrived than can have been sent. Specifically, we have the
following progression in terms of number of packets received, corresponding backlog, and
associated delay:

Time 0 1 2 2.5 3 4 5 5.5 6 7 8 8.5

Arrivals 2 1 2 1 1 2 2 1 1 1 1 1
A1,B1 A2 A3,B2 C1 B3 A4,B4 A5,B5 C2 B6 B7 B8 C3
Backlog 0 1 1 2.5 3 3 4 5.5 6 6 6 6.5

Delay 1 1 2 2.5 3 4 5 5.5 6 6 6 6.5

Given this, we see that the highest delay is equal to 0.65ms and is experienced by packet C3 (it
sees the highest backlog upon arrival).

-5-
b. [10 points] The multiplexer now implements a Round-Robin (RR) scheduling policy with
separate queues for A, B, and C, which are served in alphabetical order one packet at the time. If
multiple packets arrive simultaneously and the multiplexer is idle, it starts serving queues in
alphabetical order. Under this assumption, what is the delay experienced by packet C3? Justify
your answer by identifying the sequence of packets transmitted up to packet C3.
Using the table from the previous question, we readily see that the order of transmission is as
follows: A1(0), B1(1), A2(2), B2(3), C1(4), A3(5), B3(6), C2(7), A4(8), B4(9), C3(10), A5(11),
B5(12), B6(13), B7(14), B8(15), where the number in parenthesis next to each packet is the time
when the packet transmission starts. Based on this information, packet C3 arrives at t=8.5, and
starts service at t=10, for a difference of 1.5, so that its delay is 150secs.

c. [5 points] Under the RR scheduler, when does the last of the packets specified in Table 1 finish
transmission on the link?
Because the RR scheduler is work-conserving, the last packet starts transmission at the same time
as in the case of a FIFO scheduler, and only the order of packet transmissions is different.
The multiplexer receives a total of 16 packets, all 10,000 bits long. Because the link is always
busy after time t=0, it takes 16*100secs to transmit those packets. As a result, the last packet
finishes transmission at t=1.6ms.

-6-
4) [20 points] Consider the OSPF network below that consists of 8 routers, R1 to R8 and one Ethernet
switch T, which serves as a transit network inter-connecting routers R2 to R7. Router Ri, i=1,…,8,
has IP address 10.0.i.1 and is also connected to local subnets 10.0.i.0/24 and 10.i.0.0/16. Transit
network T maps to subnet 10.128.0.0/24. Link costs are as shown on the diagram below, and the cost
to local subnets are set to 1 on all routers.
1 10
R2 R4 R6
1 2
1 1
1
R1 T 3 R8

1 10
1
2 1
R3 R5 R7
1 10

a. [15 points] Compute the routing table at router R2. Rows in the routing table should have
the following format: <subnet, next_hop(s), cost>.
If and when one of the next hops is to be reached through transit network T, identify it as
T->Ri. Justify your answer by identifying all intermediate shortest path computation steps
involved in computing the routing table. You can assume that Flooding of LSAs has
completed, so that router R2 has access to a full “map” of the network.
Computation of the routing table proceeds in two steps. Router R2 first relies on the Dijkstra
algorithm to compute shortest paths to all other routers and transit networks in the network. Dijkstra
proceeds by moving one node from the set of candidate nodes to the set of labeled nodes (nodes with
a shortest path) at each step, as follows:
- L={<R2,loc,0>};C={<R1,R1,1>,<T,T,1>,<R4,R4,1>}
- L={<R2,loc,0>,<T,T,1>};C={<R1,R1,1.,<R3,T->R3,1>,<R4,(T,R4),1>,
<R5,T-R5,1>,<R6,T->R6,1>,<R7,T->R7,1>}
- L={<R2,loc,0>,<R1,R1,1>,<T,T,1>};C={<R3,T->R3,1>,
<R4,(T->R4,R4),1>,<R5,T->R5,1>,<R6,T->R6,1>, <R7,T->R7,1>}
- L={<R2,loc,0>,<R1,R1,1>,<T,T,1>,<R3,T->R3,1>};
C={<R4,(T->R4,R4),1>,<R5,T->R5,1>,<R6,T->R6,1>, <R7,T->R7,1>}
- L={<R2,loc,0>,<R1,R1,1>,<T,T,1>,<R3,T->R3,1>,<R4,(T->R4,R4),1>};
C={<R5,T->R5,1>,<R6,T->R6,1>, <R7,T->R7,1>}
- L={<R2,loc,0>,<R1,R1,1>,<T,T,1>,<R3,T->R3,1>,<R4,(T->R4,R4),1>,
<R5,T->R5,1>};C={<R6,T->R6,1>, <R7,T->R7,1>}
- L={<R2,loc,0>,<R1,R1,1>,<T,T,1>,<R3,T->R3,1>,<R4,(T->R4,R4),1>,<R5,T-R5,1>,
<R6,T->R6,1>}; C={<R8,T-R6,3>,<R7,T->R7,1>}

-7-
- L={<R2,loc,0>,<R1,R1,1>,<T,T,1>,<R3,T->R3,1>,<R4,(T->R4,R4),1>,<R5,T->R5,1>,
<R6,T->R6,1>,<R7,T->R7,1>};C={<R8,T->R7,2>}
- L={<R2,loc,0>,<R1,R1,1>,<T,T,1>,<R3,T->R3,1>,<R4,(T->R4,R4),1>,<R5,T->R5,1>,
<R6,T->R6,1>,<R7,T->R7,1>, <R8,T->R7,2>}
Where entries in the labeled and candidate node sets are of the form <destination, next hop(s), cost>,
and we have used the fact that in cases of ties, transit networks always need to be moved first to the
set of labeled nodes (recall that this is because their outgoing link cost is zero).
Once shortest paths are known to all, subnets are added as a post-processing step. The final routing
table at R2 is of the following form:

Subnet Next hop(s) cost

10.0.1.0/24 R1 2

10.1.0.0/16 R1 2

10.0.2.0/24 Local 1

10.2.0.0/16 Local 1

10.0.3.0/24 T->R3 2

10.3.0.0/16 T->R3 2

10.0.4.0/24 R4,T->R4 2

10.4.0.0/16 R4,T->R4 2

10.0.5.0/24 T->R5 2

10.5.0.0/16 T->R5 2

10.0.6.0/24 T->R6 2

10.6.0.0/16 T->R6 2

10.0.7.0/24 T->R7 2

10.7.0.0/16 T->R7 2

10.0.8.0/24 T->R7 3

10.8.0.0/16 T->R7 3

10.128.0.0/24 T 1

-8-
b. [5 points] The link R6-R7 goes down. How is this detected, if at all, by router R2, and how
does it affect its routing table? Justify your answer.
Router R2 is notified of the failure by receiving new Router_LSAs originated by both routers R6 and
R7 that indicate that their link to the other router is now gone. Routers R6 and R7 would typically
detect that the link went down through their Hello protocol.
Upon receiving the updated Router_LSAs from R6 and R7, router R2 proceeds to re-run its Dijkstra
algorithm. However, because the failed link was not part of any shortest paths, the new routing table
is identical to the previous one.

-9-
5) [20 points] Consider the corporate network below with three routers, R1, R2, and R3, which are
interconnected using an Ethernet networks consisting of three VLANs numbered 1, 2 and 3, with
links labeled according to the VLAN(s) they belong to. VLAN 1 is associated with subnet
11.1.0.0/16, VLAN 2 with subnet 11.2.0.0/16, and VLAN 3 with subnet 11.3.0.0/16. In addition,
router R2 provides connectivity to the rest of the Internet and consequently advertises a default route
0.0.0.0/0 that it itself receives from its ISP. Finally, router R1 provides connectivity to the rest of the
corporate network, and therefore also advertises connectivity to 11.0.0.0/8.

1,3 3 2 2
R1 S1 S2 S3 R2 ISP
0.0.0.0/0
11.0.0.0/8
1 3 2

3 3
S4 S5 S6

1 3 2

S7 S8 S9
1 2
1,2,3

R3

a. [5 points] Consider host 11.3.25.12 that has just booted and that issues a DNS query to DNS
server 53.125.45.87. Identifies which Ethernet switches in the corporate network should contain
a forwarding entry for the MAC address of host 11.3.25.12 and that of the DNS server as a result
of its DNS query. Justify your answer.
Because the DNS server is not in the subnet of host 11.3.25.12, it will need to send the query to its
default gateway, which is router R3. As a result, the host will issue an ARP query for R3 on VLAN 3.
This will result in the MAC address of host 11.3.25.12 being present in the forwarding tables of all
the switches that have a link in VLAN 3, i.e., S1, S2, S5 and S8. Furthermore, since the DNS server is
not part of any subnet of the corporate network, no Ethernet switches will contain an entry for its
MAC address.

b. [5 points] Assume that the three routers are running a standard IGP such as OSPF or EIGRP.
What routes are present in the routing table of each router?
All three routers have the same set of routes in their respective routing tables, namely:
0.0.0.0/0, 11.0.0.0/8, 11.1.0.0/16, 11.2.0.0/16, and 11.3.0.0/16.

- 10 -
c. [10 points] Host 11.23.34.56 starts an ftp connection to host 150.12.58.61. Identify the set of
switches and routers from the above network that the packets will traverse.
Host 11.23.34.56 is in the segment of the corporate network connected through router R1, so that the
packet will arrive at R1. The best match for IP address 150.12.58.61 is the default route 0.0.0.0/0
advertised by router R2. However, R1 is not directly connected to R2 (they don’t have any subnets in
common), so that it needs to first forward the packet to R3, which will in turn deliver it to R2. This
means that the full path followed by the packets through the corporate network is as follows:
R1-S1-S4-S7-S8-R3-S8-S9-S6-S3-R2
Note that because R1 and R3 are on both VLAN 1 and VLAN 3, an alternate path would be
R1-S1-S2-S5-S8-R3-S8-S9-S6-S3-R2

- 11 -
6) [20 points] Consider AS 1234 comprised of 4 routers that run iBGP among themselves and that each
connect to other routers in other ASes using eBGP. A logical representation of the AS is shown
below with the numbers next to each link indicating the shortest paths between pairs of routers, as
also shown in the table on the left. Router Ri has BGP identifier 10.0.0.i.

R1 R2 R3 R4 AS 1234
10
R1 0 10 8 10 R1 R2
8
R2 10 0 11 5 10 11
5
R3 8 11 0 7
R4 R3
7
R4 10 5 7 0

The four routers advertise to their iBGP peers the following routes that are all learned from their
eBGP peers.
0.0.0.0/0, AS_PATH: <32>, LOCAL_PREF=200
R1
153.0.0.0/8, AS_PATH: <32-1235-6578>, LOCAL_PREF=50
153.10.0.0/16, AS_PATH: <32-1235-6578>, LOCAL_PREF=50
153.10.10.0/24, AS_PATH: <32-1235-6578>, LOCAL_PREF=50
153.10.11.0/24, AS_PATH: <32-1235-6578>, LOCAL_PREF=50
72.12.34.0/24, AS_PATH: <32-4444-3498-1278>, LOCAL_PREF=50
153.0.0.0/8, AS_PATH: <22-5432-4333-6578>, LOCAL_PREF=100
R2
153.10.0.0/16, AS_PATH: <22-1235-4333-6578>, LOCAL_PREF=50
72.12.34.0/24, AS_PATH: <22-1278>, LOCAL_PREF=50
72.12.0.0/16, AS_PATH: <22-3498-1278>, LOCAL_PREF=50
53.40.51.0/24, AS_PATH: <22-235-3343-5278>, LOCAL_PREF=100
0.0.0.0/0, AS_PATH: <1>, LOCAL_PREF=100
R3
153.0.0.0/8, AS_PATH: <1-6578>, LOCAL_PREF=50
153.10.11.0/24, AS_PATH: <1-6578>, LOCAL_PREF=50
72.12.34.0/24, AS_PATH: <1-3498-1278>, LOCAL_PREF=50
14.34.0.0/16, AS_PATH: <1-784>, LOCAL_PREF=50
14.34.10.0/24, AS_PATH: <1-784>, LOCAL_PREF=50
153.0.0.0/8, AS_PATH: <11-459-6578>, LOCAL_PREF=50
R4
153.10.11.0/24, AS_PATH: <11-459-6578>, LOCAL_PREF=60
72.12.34.0/24, AS_PATH: <11-3498-1278>, LOCAL_PREF=50
14.34.0.0/16, AS_PATH: <11-784>, LOCAL_PREF=50
14.34.10.0/24, AS_PATH: <11-784>, LOCAL_PREF=50
Assume that none of the routes include a MED attribute, and that all have the same ORIGIN value.
a) [15 points] Identify the routing tables at each of the four routers. For each route entry, identify
the next hop router (use “local” when it is the router itself), and the reason for selecting the route.
No points will be awarded to answers without justifications. For conciseness, give the routing
table at R1, and for other routers only identify differences between their routing table and that of
R1.

- 12 -
Recall from the BGP selection process that LOCAL_PREF has the highest precedence, followed by
AS_PATH count, followed by eBGP over iBGP, followed by IGP cost, and finally followed by BGP
lowest identifier. Based on this, the routing tables at the four routers are identical in the entries they
contain, but differ in the NEXT_HOP they select as follows:
0.0.0.0/0, R1 chosen due to higher LOCAL_PREF of 200 for R1 vs. 100 for R3
R1
153.0.0.0/8, R2 chosen due to higher LOCAL_PREF of 100 for R2 vs. 50 for R1, R3
and R4
153.10.0.0/16, R1 chosen as R1 and R2 have the same LOCAL_PREF, but R1 has a
lower AS_PATH count of 3 vs. 4
153.10.10.0/24,R1 chosen as R1 is the only one advertising that route
153.10.11.0/24, R4 chosen due to higher LOCAL_PREF of 60 for R4 vs. 50 for R1 and R3
72.12.34.0/24, R2 chosen as all routers have the same LOCAL_PREF value of 50, but R2
has the shortest AS_PATH count of 2
72.12.0.0/16, R2 chosen as R2 is the only one advertising that route
53.40.51.0/24, R2 chosen as R2 is the only one advertising that route
14.34.0.0/16, R3 chosen as R3 has a lower IGP cost (both R3 and R4 have the same
LOCAL_PREF and AS_PATH length)
14.34.10.0/24, R3 chosen for the same reasons as 14.34.0.0/16
14.34.0.0/16, R4 chosen as R4 has the lower IGP cost of 5 (both R3 and R4 have the
R2
same LOCAL_PREF and AS_PATH length)
14.34.10.0/24, R4 chosen for the same reasons as 14.34.0.0/16
14.34.0.0/16, R3 chosen as R3 has the lower IGP cost of 0 (both R3 and R4 have the
R3
same LOCAL_PREF and AS_PATH length)
14.34.10.0/24, R3 chosen for the same reasons as 14.34.0.0/16
14.34.0.0/16, R3 chosen as R4 has the lower IGP cost of 0 (both R3 and R4 have the
R4
same LOCAL_PREF and AS_PATH length)
14.34.10.0/24, R3 chosen for the same reasons as 14.34.0.0/16

b) [5 points] For each route known in AS 1234, with the exception of the default route 0.0.0.0/0,
identify the AS to which the prefix belongs.
The AS to which the prefix belongs is typically the last one listed in the AS_PATH (for those
interested, this is only true when the AS_PATH attribute is of type SEQUENCE and not SET. The
latter is used in case of prefix aggregation, but none of the AS_PATH listed in the problem are of type
SET). This means that for the nine (9) routes known in AS 1234, the owning ASes are as follows:
- 153.0.0.0/8, 153.10.0.0.16, 153.10.10.0/24, 153.10.11.0/24: AS 6578
- 72.12.0.0/16, 72.12.34.0/24: AS 1278
- 53.40.51.0.0/24: AS 5278
- 14.34.0.0/16, 14.34.10.0/24: AS 784

- 13 -
Activity 3.5.2: Subnetting Scenario 1 (answers)

Topology Diagram

Addressing Table

Device Interface IP Address Subnet Mask Default Gateway

Fa0/0 192.168.9.129 255.255.255.224 N/A


HQ S0/0/0 192.168.9.161 255.255.255.224 N/A
S0/0/1 192.168.9.97 255.255.255.224 N/A
Fa0/0 192.168.9.193 255.255.255.224 N/A
BRANCH1 Fa0/1 192.168.9.1225 255.255.255.224 N/A
S0/0/0 192.168.9.190 255.255.255.224 N/A
Fa0/0 192.168.9.65 255.255.255.224 N/A
BRANCH2 Fa0/1 192.168.9.33 255.255.255.224 N/A
S0/0/1 192.168.9.126 255.255.255.224 N/A
PC1 NIC 192.168.9.158 255.255.255.224 192.168.9.129
PC2 NIC 192.168.9.222 255.255.255.224 192.168.9.193
PC3 NIC 192.168.9.254 255.255.255.224 192.168.9.225
PC4 NIC 192.168.9.94 255.255.255.224 192.168.9.65
PC5 NIC 192.168.9.62 255.255.255.224 192.168.9.33

Learning Objectives
Upon completion of this lab, you will be able to:
• Determine the number of subnets needed.
• Determine the number of hosts needed.
• Design an appropriate addressing scheme.

Copyright  2007, Cisco Systems, Inc. Routing Protocols and Concepts v1.0 –Activity 3.5.2 1 of 3
• Assign addresses and subnet mask pairs to device interfaces and hosts.
• Examine the use of the available network address space.
• Determine how static routing could be applied to the network.

Scenario
In this lab, you have been given the network address 192.168.9.0/24 to subnet and provide the IP
addressing for the network shown in the Topology Diagram. The network has the following addressing
requirements:
• The BRANCH1 LAN 1 will require 10 host IP addresses.
• The BRANCH1 LAN 2 will require 10 host IP addresses.
• The BRANCH2 LAN 1 will require 10 host IP addresses.
• The BRANCH2 LAN 2 will require 10 host IP addresses.
• The HQ LAN will require 20 host IP addresses.
• The link from HQ to BRANCH1 will require an IP address for each end of the link.
• The link from HQ to BRANCH2 will require an IP address for each end of the link.

Task 1: Examine the Network Requirements.


Examine the network requirements and answer the questions below. Keep in mind that IP addresses will
be needed for each of the LAN interfaces.
How many subnets are needed? _____7_____
What is the maximum number of IP addresses that are needed for a single subnet? _____21_____
How many IP addresses are needed for each of the branch LANs? _____11_____
What is the total number of IP addresses that are needed? _____69_____

Task 2: Design an IP Addressing Scheme.

Step 1: Subnet the 192.168.9.0 network into the appropriate number of subnets.
What will the subnet mask be for the subnetworks? _____________255.255.255.224 or
/27_____________
How many usable host IP addresses are there per subnet? _____30_____
Fill in the following chart with the subnet information.

Subnet First Usable Last Usable Broadcast


Subnet Address
Number Host Address Host Address Address
0 192.168.9.0 192.168.9.1 192.168.9.30 192.168.9.31
1 192.168.9.32 192.168.9.33 192.168.9.62 192.168.9.63
2 192.168.9.64 192.168.9.65 192.168.9.94 192.168.9.95
3 192.168.9.96 192.168.9.97 192.168.9.126 192.168.9.127
4 192.168.9.128 192.168.9.129 192.168.9.158 192.168.9.159
5 192.168.9.160 192.168.9.161 192.168.9.190 192.168.9.191
6 192.168.9.192 192.168.9.193 192.168.9.222 192.168.9.223
7 192.168.9.224 192.168.9.225 192.168.9.254 192.168.9.255

Step 2: Assign the subnets to the network shown in the Topology Diagram.
When assigning the subnets, keep in mind that routing will need to occur to allow information to be sent
throughout the network. The subnets will be assigned to the networks to allow for route summarization on
each of the routers.

Copyright  2007, Cisco Systems, Inc. Routing Protocols and Concepts v1.0 – Activity 3.5.2 2 of 3
1. Assign subnet 1 to the BRANCH2 LAN 2: __________192.168.9.32 /27__________
2. Assign subnet 2 to BRANCH2 LAN 1 subnet address: __________192.168.9.64 /27__________
3. Assign subnet 3 to link from HQ to BRANCH2 subnet address: __________192.168.9.96
/27__________
4. Assign subnet 4 to HQ LAN subnet address: __________192.168.9.128 /27__________
5. Assign subnet 5 to link from HQ to BRANCH1 subnet address: __________192.168.9.160
/27__________
6. Assign subnet 6 to BRANCH1 LAN 2 subnet address: __________192.168.9.192 /27__________
7. Assign subnet 7 to BRANCH1 LAN 1 subnet address: __________192.168.9.224 /27__________

Task 3: Assign IP Addresses to the Network Devices


Assign the appropriate addresses to the device interfaces. Document the addresses to be used in the
Addressing Table provided under the Topology Diagram.

Step 1: Assign addresses to the HQ router.


1. Assign the first valid host address in the HQ LAN subnet to the LAN interface.
2. Assign the first valid host address in link from HQ to BRANCH1 subnet to the S0/0/0 interface.
3. Assign the first valid host address in link from HQ to BRANCH2 subnet to the S0/0/1 interface.

Step 2: Assign addresses to the BRANCH1 router.


1. Assign the first valid host address in the BRANCH1 LAN 1 subnet to the Fa0/0 LAN interface.
2. Assign the first valid host address in the BRANCH1 LAN 2 subnet to the Fa0/1 LAN interface.
3. Assign the last valid host address in link from HQ to BRANCH1 subnet to the WAN interface.

Step 3: Assign addresses to the BRANCH2 router.


1. Assign the first valid host address in the BRANCH2 LAN 1 subnet to the Fa0/0 LAN interface.
2. Assign the first valid host address in the BRANCH2 LAN 2 subnet to the Fa0/1 LAN interface.
3. Assign the last valid host address in link from HQ to BRANCH2 subnet to the WAN interface.

Step 4: Assign addresses to the host PCs.


1. Assign the last valid host address in the HQ LAN subnet to PC1.
2. Assign the last valid host address in the BRANCH1 LAN 1 subnet to PC2.
3. Assign the last valid host address in the BRANCH1 LAN 2 subnet to PC3.
4. Assign the last valid host address in the BRANCH2 LAN 1 subnet to PC4.
5. Assign the last valid host address in the BRANCH2 LAN 2 subnet to PC5.

Copyright  2007, Cisco Systems, Inc. Routing Protocols and Concepts v1.0 – Activity 3.5.2 3 of 3
2 Spanning Tree Algorithm
a) Given the network shown in Figure ??, where the letters A to J represent LANs and the
Exercises
circles B1 to B7 represent a switch node. Indicate which ports are not selected by the spanning 227
tree algorithm.

B
B7
C B2
D B5
B1
E F

B3

G H

B4 B6
I
J

Figure
Figure 3.37 Network
1: Network for Exercises
for spanning 13 and 14.
tree algorithm

Answer: We depict the collection ofB3switchesCin a local area network (LAN) as a graph
whose nodes are switches and LAN segments (or cables), and whose edges are the interfaces
connecting the switches to the segments.
The spanning tree algorithm
A follows 1 :
works as B2
B1
• Elect a single switche, among all the switches on all the LANs, to be the Root Bridge.
• Calculate the distance of the shortest path from the switches to the Root Bridge.
B4 D
• For each LAN, elect Designated Bridge from among the switches residing on that LAN.
The elected switche is the one closest to the Root Bridge. The Designated Bridge will
forward packets from that LAN toward the Root Bridge.
• Choose a portFigure
(known3.38
as theNetwork for
root port) Exercises
that gives the15best
andpath
16. from each Designated
Bridge to the Root Bridge.
• Select ports to be included
■ in
A the spanning
sends to C. tree. The port selected will be the root port
plus any ports on which ’self’ has been elected Designated Bridge.
■ C sends to A.
The ports which are not selected by the spanning tree algorithm are shown as red dotted
lines in Figure ??. ■ D sends to C.
b) Given the network shown in Figure
Identify ??,with
ports assume
the that switch
unique B1 suffers
neighbor catastrophic
reached failure.
directly from that port; that is,
Indicate which ports are not selected by the spanning tree algorithm after the recovery process
and a new tree has beenthe ports for B1 are to be labelled “A” and “B2.”
formed.
Answer: After the recovery process, the new formed spanning tree is shown in Figure ??.
Asselected
16not
The ports which are in the previous problem,
by the spanning treeconsider thearearrangement
algorithm shown as redofdotted
learning bridges shown
lines. in Figure 3.38. Assuming all are initially empty, give the forwarding tables for
each of (2nd
1 Radia Perlman. 1999. Interconnections the bridges B1–B4
Ed.): Bridges, afterSwitches,
Routers, the following transmissions:
and Internetworking Protocols.
Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.

2
B7 A B2 B B5

C D F

Root bridge

B1 E B3 Designated bridge

Blocked port

G H

B4 I B6 J

Figure 2: Spanning tree a)

B7 A B2 B B5

C D F

Root bridge

E B3 Designated bridge

Blocked port

G H

B4 I B6 J

Figure 3: Spanning tree b)

3 Switches
a) Store-and-forward switches have an advantage over cut-through switches with respect to dam-
aged frames. Explain what it is.
Answer: Store-and-forward switches store entire frames before forwarding them. After
a frame comes in, the checksum can be verified. If the frame is damaged, it is discarded
immediately. With cut-through, damaged frames cannot be discarded by the switch because
by the time the error is detected, the frame is already gone.
b) What is the big benefit of using switches to connect hosts?
Answer: A switch is basically a multi-port equipment. Every host has a private, non-shared
link to the switch (“network segment” with one single host connected to it). Therefore there
are no collisions at all on these links which is a big benefit over shared media.

4 IP Checksum
Here is a IP header from an IP packet received at destination :
4500 003c 1c46 4000 4006 b1e6 ac10 0a63 ac10 0a0c
Please compute the checksum for the header.
Answer:
We convert all these values in binary :
4500 -¿ 0100010100000000 003c -¿ 0000000000111100 1c46 -¿ 0001110001000110 4000 -¿ 0100000000000000
4006 -¿ 0100000000000110 0000 -¿ 0000000000000000 // Note that the checksum is set to zero since
we are computing checksum at destination end ac10 -¿ 1010110000010000 0a63 -¿ 0000101001100011
ac10 -¿ 1010110000010000 0a0c -¿ 0000101000001100

You might also like