7.SupposenodesA,B,andCeachattachtothesamebroadcastLAN(throughtheiradapters).IfAsendsthousandsofIPdatagramstoBwitheachencapsulatingframeaddressedtotheMACaddressofB,willC’sadapterprocesstheseframes?
Ifso,willC’sadapterpasstheIPdatagramsintheseframestothenetworklayerC?
HowwouldyouranswerschangeifAsendsframeswiththeMACbroadcastaddress?
不会,C会拆封帧从而读取报头的MAC,因为每一个host的MAC都唯一,C读取到数据报中的MAC和自己的不一样就不会继续拆封数据报,不会投递给C。
当使用LAN口广播地址的时候,C的适配器就会拆封帧,向C传递数据。
8.HowbigistheMACaddressspace?
TheIPv4addressspace?
TheIPv6addressspace?
2^48,2^32,2^128.
9.WhyisanARPquerysentwithinabroadcastframe?
WhyisanARPresponsesentwithinaframewithaspecificdestinationMACaddress?
因为新加入网络的主机是不知道路由器的IP的,自己也没有IP,所以只能广播才能得到IP。
因为每个主机的MAC地址都是唯一的,而ARP建立转发表的时候会带上MAC地址。
12.InCSMA/CD,afterthefifthcollision,whatistheprobabilitythatanodechoosesK=4?
TheresultK=4correspondstoadelayofhowmanysecondsona10MbpsEthernet?
可能,因为第五次K的取值范围是0-(2^5-1)即0-31。
Bittime=1bit/R=1bit/10Mbps=1msec,K=4,waittime=4*512*1msec=2048msec。
Problems:
1.Supposetheinformationcontentofapacketisthebitpattern1110110010001010andanevenparityschemeisbeingused.Whatwouldthevalueofthefieldcontainingtheparitybitsbeforthecaseofatwo-dimensionalparityscheme?
Youranswershouldbesuchthataminimum-lengthchecksumfieldisused.假设一个数据包的信息含量是XXX,使用偶校验方案。
采用二位奇偶校验方案的字段包含的奇偶校验位的字段的值是多少?
答案要使用最小长度校验。
10100
10100
10100
10111
00011
2.Supposetheinformationportionofapacket(DinFigure5.4)contains10bytesconsistingofthe8-bitunsignedbinaryASCIIrepresentationoftheintegers0through9.ComputetheInternetchecksumforthisdata.假设一个包的信息的一部分包括10bytes组成的8-bit无符号二进制码表示的整数0-9,计算该数据的网络校验。
算校验码先把0-9加起来
0000000000000001
0000001000000011
0000010000000101
0000011000000111
0000100000001001
0001010000011001
→→→→取反可得
校验码为1110101111100110
3.Considerthepreviousproblem,butinsteadofcontainingthebinaryofthenumbers0through9supposethese10bytescontain.ComputetheInternetchecksumforthisdata.
a.thebinaryrepresentationofthenumbers1through10.
0000000100000010
0000001100000100
0000010100000110
0000011100001000
0000100100010100
0001101100011110
→→→→取反可得
1110010011100001
b.theASCIIrepresentationofthelettersAthroughJ(uppercase).
0100000101000010
0100001101000100
0100010101000110
0100011101001000
0100100101001010
0101100001011111
→→→→取反可得
1010011110100000
c.theASCIIrepresentationofthelettersathroughj(lowercase).小写字母表示
0110000101100010
0110001101100100
0110010101100110
0110011101101000
0110100101101010
1111100111111101
→→→→取反可得
0000011000000010
6.Considerthepreviousproblem,butsupposethatDhasthevalue
a.10010001.
b.10100011.
c.01010101.
前一题题目:
Considerthe7-bitgenerator,G=10011,andsupposethatDhasthevalue1010101010.WhatisthevalueofR?
求余而已,记住不要做减法而是做与运算就好。
a.R=001
b.R=101
c.R=101
12.ConsiderthreeLANsinterconnectedbytworouters,asshowninFigure5.38.
a.Redrawthediagramtoincludeadapters.重新画图
b.AssignIPaddressestoalloftheinterfaces.ForSubnet1useaddressesoftheform111.111.111.xxx;forSubnet2usesaddressesoftheform122.122.122.xxx;andforSubnet3useaddressesoftheform133.133.133.xxx.所有的接口分配IP地址。
c.AssignMACaddressestoalloftheadapters.
a.b.c如图
d.ConsidersendinganIPdatagramfromHostAtoHostF.SupposealloftheARPtablesareuptodate.Enumerateallthesteps,asdoneforthesingle-routerexampleinSection5.4.2.
1.hostA发送一个数据报,通过转发表查询F的IP,向路由器1发送,其中destinationIP为133.133.133.12,MAC未知,sourceIP为111.111.111.12,sourceMAC为aa-aa-aa-aa-aa-aa。
2.适配器更改destination的IP为111.111.111.12,MAC地址变为gg-gg-gg-gg-gg-gg
3.路由器1发现目标IP和MAC不属于子网1中任何host,属于子网3(图中忘了画了,意会一下)。
于是根据转发表向路由器2进行转发。
Destination的IP为122.122.122.20,MAC为ii-ii-ii-ii-ii-ii。
4.路由器2收到了数据报,发现hostF在自己的子网内,于是修改destination的IP为133.133.133.12,MAC地址为ff-ff-ff-ff-ff-ff。
修改sourceIP为133.133.133.20,MAC为jj-jj-jj-jj-jj-jj,然后向F发送数据报。
5.F收到来自A的数据报。
e.Repeat(d),nowassumingthattheARPtableinthesendinghostisempty(andtheothertablesareuptodate).
发送方的ARP表为空,首先需要建立ARP表
1.hostA发送一个广播,destinationIP是255.255.255.255,MAC为空。
SourceIP为111.111.111.12,MAC为aa-aa-aa-aa-aa-aa
2.适配器收到了来自hostA的数据报,更新自己的ARP表,同时发送一个ACK给hostA,告诉hostA自己的IP、MAC。
3.hostA建立ARP表
4.如d小问所答,开始进行数据发送。
14.RecallthatwiththeCSMA/CDprotocol,theadapterwaitsK·512bittimesafteracollision,whereKisdrawnrandomly.ForK=100,howlongdoestheadapterwaituntilreturningtoStep2fora10MbpsEthernet?
Fora100MbpsEthernet?
当网速=10Mbps时,bittime=1bit/10Mbps
t=100*512*1/(10^6)=5.12msec
当网速=100Mbps时,bittime=1bit/100Mbps
t=100*512*1/(10^7)=0.512msec
15.SupposenodesAandBareonthesame10MbpsEthernetbus,andthepropagationdelaybetweenthetwonodesis225bittimes.SupposeAandBsendframesatthesametime,theframescollide,andthenAandBchoosedifferentvaluesofKintheCSMA/CDalgorithm.Assumingnoothernodesareactive,cantheretransmissionsfromAandBcollide?
Forourpurposes,itsufficestoworkoutthefollowingexample.SupposeAandBbegintransmissionatt=0bittimes.Theybothdetectcollisionsatt=225bittimes.Theyfinishtransmittingajamsignalatt=225+48=273bittimes.SupposeKA=0andKB=1.AtwhattimedoesBscheduleitsretransmission?
AtwhattimedoesAbegintransmission?
(Note:
ThenodesmustwaitforanidlechannelafterreturningtoStep2—seeprotocol.)AtwhattimedoesA’ssignalreachB?
DoesBrefrainfromtransmittingatitsscheduledtime?
1.因为A的K值=0,所以A从273bittime开始检测是否冲突
2.由于传输延迟的问题,B的最后一个bit要等到273+225=498bittime才能传到A,也就是说此时A检测到没有冲突。
3.A传输前先等待96个bittime,即t=498+96=594bittime的时候A开始传输数据
4.因为propagationdelay=225bittime,所以t=594+225=819bittime的时候A传输完毕
5.因为KB=1,当B等待1*512*1=512bittime的时候,B可以重传,此时B开始检测信道是否空闲,此时t=273+512=785bittime
6.此时B检测到信道忙,因此不能重传,等待信道空闲
7.当t=819bittime的时候信道空闲,此时B等待96bittime,即t=96+819=915bittime的时候B可以开始重传
16.SupposenodesAandBareonthesame10MbpsEthernetbus,andthepropagationdelaybetweenthetwonodesis225bittimes.SupposenodeAbeginstransmittingaframeand,beforeitfinishes,nodeBbeginstransmittingaframe.CanAfinishtransmittingbeforeitdetectsthatBhastransmitted?
Whyorwhynot?
Iftheanswerisyes,thenAincorrectlybelievesthatitsframewassuccessfullytransmittedwithoutacollision.Hint:
Supposeattimet=0bittimes,Abeginstransmittingaframe.Intheworstcase,Atransmitsaminimum-sizedframeof512+64bittimes.SoAwouldfinishtransmittingtheframeatt=512+64bittimes.Thus,theanswerisno,ifB’ssignalreachesAbeforebittimet=512+64bits.Intheworstcase,whendoesB’ssignalreachA?
因为A最快传输时间t=512+64bittime,看了答案,微积分神马的可以让我shi了……
LetYbearandomvariabledenotingthenumberofslotsuntilasuccess:
P(Y=m)=β(1-β)^(m-1)
Whereβistheprobabilityofasuccess.
Thisisageometricdistribution,whichhasmean1/β.ThenumberofconsecutivewastedslotsisX=Y–1that
x=E[X]=E[Y]-1=(1-β)/β
β=Np(1-p)^(N-1)
x={1–Np*(1-p)^(N-1)}/{Np*(1-p)^(N-1)}
efficiency=k/(k+x)=k/{k+[1–Np*(1-p)^(N-1)]/[Np(1-p)^(N-1)]}
19.Supposetwonodes,AandB,areattachedtooppositeendsofa900mcable,andthattheyeachhaveoneframeof1,000bits(includingallheadersandpreambles)tosendtoeachother.Bothnodesattempttotransmitattimet=0.SupposetherearefourrepeatersbetweenAandB,eachinsertinga20-bitdelay.Assumethetransmissionrateis10Mbps,andCSMA/CDwithbackoffintervalsofmultiplesof512bitsisused.Afterthefirstcollision,AdrawsK=0andBdrawsK=1intheexponentialbackoffprotocol.Ignorethejamsignalandthe96-bittimedelay.
a.Whatistheone-waypropagationdelay(includingrepeaterdelays)betweenAandBinseconds?
Assumethatthesignalpropagationspeedis2·10^8m/sec.
传输时间t0=900m/[2*(10^8)m/sec]=4.5μsec
Repeater传输延迟t1=4*20bit/10Mbps=8μsec
T=t0+t1=12.5μsec
b.Atwhattime(inseconds)isA’spacketcompletelydeliveredatB?
(为什么这里答案没有96个bittime的等待?
?
?
)
1bittime=1/10Mbps=0.1μsec
当t=12.5μsec时,A、B检测到冲突,停止传输。
A的K值=0,于是A立即开始检测信道是否空闲,当B传