计算机网络与因特网(第六版)课后习题答案(全网最全)

网络通信详解:TCP/IP协议、局域网拓扑与分组交换
本文详细介绍了TCP/IP协议的层次结构,包括物理层、链路层、网络层、传输层和应用层的功能,以及以太网的工作原理,强调了分层和协议分层的重要性。同时,探讨了局域网的三种拓扑结构——星型、环型和总线型,以及它们各自的特点和代表性网络。此外,还阐述了分组交换中的分片和重组过程,以及地址解析协议(ARP)和ICMP的作用。

【私藏多年的绝版资料,现在免费送给你,随时会被删除,千万保存下来!有道云笔记

目录

三、第三周:

1.局域网有哪几种拓扑结构,各有什么特点?分别举出一种有代表性的网络。

2.简述以太网的工作原理。

3.说出IEEE定义的第2层协议的两个子层名称,并指出它们的用途。

4.简述广播和多播的技术原理和特点。

5.简单描述以太网的帧格式

四、第四周:

1. 理解TCP/IP协议的层次结构和各层功能。

2. 比较与ISO/OSI参考模型的异同。

3. TCP/IP网络体系结构为什么要保证网络层的协议一致。

4.网络协议为什么要分层?

5. ISO-OSI参考模型包括哪些层次,各有什么作用?不同层次数据包结构如何设计?

五、第五周:

1.从C1向C5发送一个IP报头(报文总长1200B),给出此IP报文在N1、N2、N3、N4、N5中的每个分片的大小及其偏移量

六、第六周:

1.简述2种地址解析方法的原理。

2.简述ARP发送和接收端的操作过程

3. ICMP对IP数据传输采取了哪些控制措施?

4. 理解TraceRoute和PING的原理。

5. 考虑如何利用ICMP协议对一个网络上的时延性能进行监控?

6. TCP如何考虑数据传输连接的建立和拆除?

 7. TCP如何考虑流量控制和拥塞控制?

七、第七周:

1.为什么客户发出的控制连接是主动打开,但发出的数据连接是被动打开?

八、第八周:

4.以最少跳数作为最短路径,给出下面图形中所有交换设备的路由表。

九、第九周:

1.通过图示RIP协议对距离-向量算法的增强过程。

2.简述RIP/OSPF/BGP协议的原理及其应用。

十一、第十一周:

1. Client-Server模式的产生原因及其功能。

2. Socket接口及其在Client-Server模式中的执行模式。

十二、第十二周:

1. 若已经建立了一条TCP连接,为什么要传送邮件时还要建立一条TCP连接。

2. 在SMTP中,若在两个用户间只发送1行的报文,则要交换的命令和响应共有多少行。

十三、第十三周:

1. HTTP的GET方法与POST方法有何区别?

2. 静态文档、动态文档与活动文档有何区别

一、第一周:

1. 什么是 RS-232? RS-232 有什么特点?

9.3 When transmitting a 32-bit 2’s complement integer in big-endian order, when is the sign bit transmitted? ( 9.3 以正序传输 32 位的二进制补码整数时,何时发送符号位?)

二、第二周:

1. 什么是调制与解调?调制与解调有哪些基本方法?

2. 载波复用技术有哪几种?各有什么特点?


三、第三周:

1.局域网有哪几种拓扑结构,各有什么特点?分别举出一种有代表性的网络。

答:星型网;代表性的网络:异步传输模式(ATM);特点是一个主机和各个计算机相连,每个计算机之间的通信都要通过主机作为中继,呈现出星型的拓扑结构。网络结构简单,便于管理,单个计算机瘫痪不会影响到其他主机,但中心节点的故障会引起整个系统瘫痪。

环形网;代表性的网络:IBM的令牌环、光纤分布数据互联(FDDI);特点是每个相邻通信的电脑通过点对点连接直到形成一个闭环,非相邻电脑通信需要通过别的电脑作为中介才能实现通信。结构简单,容易监控通断情况,但建成后很难增加新的节点,且某个节点的异常影响其它节点的通信。

总线网;代表性的网络:以太网、LocalTalk;特点是每个计算机和数据总线相连,总线这一传输媒介为各计算机共享使用,通过向总线发送数据,向总线两端发送数据,接收方也可以从总线收到数据。在任何时候只有一台主机能够正常往总线发送数据。安装简单方便,成本低,某个站点的故障一般不会影响整个网络;但介质的故障会导致网络瘫痪,同时线网安全性低,容易被中断通信和监听。

2.简述以太网的工作原理。

答:   【重点常考知识点】以太网是总线型的网络拓扑结构,采用“带冲突检测载波帧听多路访问机制(CSMA/CD)”。以太网(局域网内,或没做隔离措施的网络)中所有节点都可以看到在网络中发送的所有信息,因此,以太网是一种广播网络。 当以太网中的一台主机要传输数据时,它将按如下步骤进行:   1、监听信道上是否有信号在传输;如果有,则说明信道处于忙状态,就继续帧听,直到信道空闲为止。   2、若没有监听到任何信号,就传输数据    3、传输的时候继续帧听;如发现冲突,则执行退避算法,随机等待一段时间后,重新执行步骤1(当有冲突时,涉及冲突的计算机会返回到监听信道的状态)。注意,每台计算机一次只允许发送一个包或一个拥塞序列,以警告所有的节点。    4、若未发现冲突则发送成功,所有计算机在试图再一次发送数据之前,必须在最近一次发送后等待9.6微秒(假设以10Mbps运行)。

3.说出IEEE定义的第2层协议的两个子层名称,并指出它们的用途。

(Name the two sublayers of Layer 2 protocols defined by IEEE, and give the purpose of each)

答:介质访问控制(MAC子层) 1 数据帧的封装/卸装    2 帧的寻址和识别,帧的接收与发送    3 链路管理    4 帧的差错控制  

逻辑链路控制(LLC子层)    1 传输可靠性保障和控制    2 数据包的分段和重用    3 数据包的顺序传输    4 寻址和解复用

 13.7什么是点对点网络?(What is a point-to-point network?)

答:点对点连接是两个系统或进程之间的专用通信链路。点对点网络由很多互相连接的节点组成,在每对机器之间由单独的通信通道,比如网状网络,就是点对点连接。

4.简述广播和多播的技术原理和特点。

答:广播技术原理:发送方按照广播地址向共享介质发送数据帧,网上所有设备的网卡进行数据帧拷贝放入内存,中断CPU,让系统软件判别是否丢弃该数据帧。广播的特点:所有网上的计算机都可以拷贝到数据包,由接收方CPU决定是否保留数据帧。

多播技术原理:发送方按照多播地址向共享介质发送数据帧,网上设备网卡根据程序确定接收或丢弃数据帧。多播的特点 ①单播和广播是两个极端,要么一个,要么全部。而多播提供一种折衷方案,多播数据报仅由对该数据报感兴趣的接口接收。   ②广播一般局限于局域网,而多播既可以用于局域网也可以跨越广域网。

5.简单描述以太网的帧格式

Ethernet II是以太网最常见的帧格式之一:帧头部由6个字节的目的MAC地址,6个字节的源MAC地址,2个字节的类型域(用于表示装在这个帧里面的数据类型),接下来是46--1500 字节的数据,和4字节的帧校验

拓展:随着以太网的的广泛应用和发展出现了一些变种和拓展,以满足不同的需求,大家可以自行学习:

13.2 In a circuit-switched network(线路交换网络),can multiple circuits share a single optical fiber(共享单条光纤)? 在电路交换网络中,多条电路能否共享单条光纤?试解释之。

答:可以共享。因为多条电路可以复用一条光纤实现通信。而且这条共享介质光纤就是虚电路。(ps:虚电路是依据需求临时建立的电路路径,需要占用一定的介质资源,用于传输数据,当数据传输结束后,虚电路会被拆除,释放资源,其它电路得以连接)

13.4 If someone wanted to broadcast a copy of a video presentation, is a circuit switching system(线路交换) or a packet switching(分组交换) perferable?Why? 如果某人想广播一个视频副本,电路交换和分组交换哪个更可取?为什么?

答:分组交换更好。因为电路交换的特点是点对点通信。分组交换是允许多对多的通信,所以分组交换更利于广播;此外,分组交换模式采用异步的通信的方式,更具便利性。(ps:电路交换是建立一个专用的物理连接来传输数据,适合实时、连续的通信,如电话通话;而分组交换则是将数据切分成小的数据包进行传输,适合传输量大、接收对象多、灵活性高的场景,如互联网通信)

四、第四周:

1. 理解TCP/IP协议的层次结构和各层功能。

答:【重点常考知识点】TCP/IP协议的层次结构及对应功能:

第一层:物理层。规定底层传输介质和相关硬件的细节。(关键词:介质、硬件)

第二层:链路层。处理数据在物理网络中的传输和接收,主要由控制硬件的MAC(介质访问控制层)与LLC(逻辑链路子层)两个子层组成。

第三层:网络层。规定计算机间通过网络进行通信的细节,包括编址结构、分组格式等。包括:IP协议、RIP协议(路由信息协议)、OSPF,负责数据的包装、寻址和路由;同时还包含ICMP(网间控制报文协议)用来实现差错报告机制。

第四层:传输层。用于实现应用程序间的通信,提供了传输速率控制、拥塞避免等机制。具有TCP和UDP两个具有代表性的协议,提供了端到端的通信服务。其中TCP协议(Transmission Control Protocol)提供可靠的数据流传输服务,UDP协议(Use Datagram Protocol)提供不可靠的数据报服务。

第五层:应用层。提供应用程序与网络间的接口,负责处理特定的应用需求和数据传输。  

2. 比较与ISO/OSI参考模型的异同。

异:ISO/OSI参考模型不同于TCP/IP,它有七层分层:物理层、数据链路层、网络层、传输层、会话层、表示层和应用层。OSI参考模型的协议对比TCP/IP参考模型更具有面向对象的特性,对服务、接口、协议更为明确。

同:都采用分层的方法,每层都建立在下一层之上;两种模型都是独立的协议栈,用于解决计算机之间的数据传输问题。

 

3. TCP/IP网络体系结构为什么要保证网络层的协议一致。

答:为了保证数据包能送到目的站点,同时可以正确解析数据包,必须保证网络层的协议一致。如果网络层的协议不一致,数据分组的封装格式不相同,就算实现了发送接收,也无法正确识别出数据包;路由器无法正确解析逻辑地址,连数据包准确发送到目的站点都无法做到。

4.网络协议为什么要分层?

答:为了简化网络设计的复杂性,各层协议之间既相互独立又相互便利。

分层的好处有: ① 灵活性好:当任何一层发生变化时,只要层间接口关系保持不变,则其它层不受影响。此外,对某一层提供的服务还可进行修改。当某层提供的服务不再需要时,甚至可以将这层取消,更容易管理。 ② 各层之间是独立的:在各层间标准化接口,允许不同的产品只提供各层功能的一部分,某不需要知道它的下一层是如何实现的,而仅仅需要知道该层通过层间的接口所提供的服务。由于每一层只实现-种相对独立的功能,所以比较容易实现。

5. ISO-OSI参考模型包括哪些层次,各有什么作用?不同层次数据包结构如何设计?

答:1、物理层的主要功能是利用传输介质为数据链路层提供物理连接,负责数据流的物理传输工作。物理层传输的基本单位是比特流,即0和1,也就是最基本的电信号或光信号,是最基本的物理传输特征。

2、数据链路层是在通信实体间建立数据链路连接,数据链路控制子层会接受网络协议数据、分组的数据报并且添加更多的控制信息,从而把这个分组传送到它的目标设备。

3、网络层是以路由器为最高节点俯瞰网络的关键层,它负责把分组从源网络传输到目标网络的路由选择工作。互联网是由多个网络组成在一起的一个集合,正是借助了网络层的路由路径选择功能,才能使得多个网络之间的联接得以畅通,信息得以共享。

4、传输层使用网络层提供的网络联接服务,依据系统需求可以选择数据传输时使用面向联接的服务或是面向无联接的服务。

5、会话层的主要功能是负责维护两个节点之间的传输联接,确保点到点传输不中断,以及管理数据交换等功能。会话层在应用进程中建立、管理和终止会话。会话层还可以通过对话控制来决定使用何种通信方式,全双工通信或半双工通信。会话层通过自身协议对请求与应答进行协调。

6、表示层的主要功能是处理在两个通信系统中交换信息的表示方式,主要包括数据格式变化、数据加密与解密、数据压缩与解压等。在网络带宽一定的前提下数据压缩的越小其传输速率就越快,所以表示层的数据压缩与解压被视为掌握网络传输速率的关键因素。

7、应用层采用不同的应用协议来解决不同类型的应用要求,并且保证这些不同类型的应用所采用的低层通信协议是一致的。应用层中包含了若干独立的用户通用服务协议模块,为网络用户之间的通信提供专用的程序服务。

 

(解析:地址类型:A类范围0~127,最高位0开头。B类范围128~191,最高位10开头。C类范围192~223,最高位110开头。D类范围224~239,最高位1110开头。

网络位数:每类地址前缀部分,A类8位,B类16位,C类24位,D类32位。斜杠后的数字表示从地址最左边开始连续的1的个数。子网位数=斜杠后的数-网络位数。主机位数=32-斜杠后的数。)

答:218.193.48.48/27

地址类型:C类。(218=11011010以110开头)

网络位数:24,子网位数:3,主机位数:5(C类地址网络位数24,子网位数=27-24=3,主机位数=32-27=5)

子网掩码:255.255.255.0

支持主机数:30(2^5-2=30,减2的原因为:全0标示的是子网的网络地址,用于表示子网的起始位置,全1标示的是广播地址,所以要扣除这两个地址)

答:6.23.136.43/16

地址类型:A类(6=00000110以0开头)

网络位数:8,子网位数:8,主机位数:16

子网掩码:255.0.0.0

支持主机数:65534(2^16-2=65534)

 

(解析:说明一下,R1、R2...这些是路由器;C1、C2....这些是主机,可以理解为计算机;路由器与路由器间的线代表的是网络,比如R1到R2这条线代表的网络是10.0.0.0,R2到R4代表的网络是30.0.0.0,以此类推...

答:路由器有一个别名叫作“网关”,可以很形象地理解为网络的关口,一个路由器可以连接不同网络,比如R2路由器连接R1、R3、R4的“关口”分别为:10.0.0.4、20.0.0.1、30.0.0.1)

(可能还有同学不明白这道题的意思,在这里我解释一下,Destination表示的是目标网络,Mask表示的是子网掩码,Next Hop表示的是下一跳

比如拿R3举例,如果R3路由器想转发数据到网络20.0.0.0和40.0.0.0,因为这两个网络都直接和路由器本身连通,所以可以直接传送,但如果想传送数据到网络10.0.0.0或者30.0.0.0,就必须要经过R2路由器,通过关口20.0.0.1,大致就是这个意思)

五、第五周:

1.从C1向C5发送一个IP报头(报文总长1200B),给出此IP报文在N1、N2、N3、N4、N5中的每个分片的大小及其偏移量

分析:每经过一个路由器Ri会加上一个报文头。除了最后一个分片之外,其它分片的大小必须是8的倍数,注意分片的大小指的是一个报文去掉报头后的大小。注意首先会对IP报文进行分片,然后再为每个分片添加IP报头,因此要预留上IP报头的大小。特别注意:只有对需要分片的报文才需要附带新的IP报文头部,如果原始的IP报文的大小不超过MTU则不需要增加新的报文头部。还需要注意:当需要对一个IP报文进行重新分片时,还需要先去掉原始报文的头部。

答:【重点常考题】以N2段为例:在N1段,报文总长1200B(在R1处已加报头)。在N2段,先对1200B进行分片,对第1个分片,因为MTU为800B,所以用800B-报头(20B)=780B,小于780B能被8整除的数是776B(=97*8),加上报头,所以第1片是796B。对第2片,还剩下404B内容,所以是404B+20B=424B,偏移量取前面的97。需要注意最后一个分片的大小的不要求是8的倍数。

在以N3段为例:第1片中数据的长度是776B,MTU最大为600B,因此用600-报头=580B,小于580且能被8整除的数的576(=72*8),所以第一片大小576+20=596B,偏移量为0,剩下200B(776B-576B)内容自成一片,加上报头为220B,偏移量为72。再对第2片分片,因为424<600,所以不需要分片,也不需要加上新的报文头部,所以大小是424B。

以此类推,下面的答案;

六、第六周:

1.简述2种地址解析方法的原理。

(1)查表法:地址联编或映射信息存储在内存当中的一张表里,当软件要解析一个地址时,可在其中找到所需结果。查表方法需要一张包含地址联编信息的表,表中的每一项是一个二元组( P,H),P是协议地址,H是指等价的物理地址。每一项对应于网络中的一个站。项包含两个域,一个是站的IP地址,另一个是站的硬件地址。给出下一站的IP地址N,软件就开始搜索表,直到发现某一项的IP地址域与N匹配,则该项的硬件地址域中的值被输出。

(2)信息交换法:计算机通过网络交换消息来解析一个地址。一台计算机发出某个地址联编的请求消息后,另一台计算机返回一个包含所需信息的应答消息。当某台计算机需要解析一个IP地址时,会通过网络发送一个请求消息,之后会收到一个应答。发送出去的消息包含了对指定协议地址进行解析的请求,应答消息包含了对应的硬件地址。

(3)相近形式计算:仔细地为每一台计算机挑选协议地址,使得每台计算机的硬件地址可通过简单的布尔和算术运算得出它的协议地址。当一台计算机连入一个动态编址的网络时,该网的管理员必须为它挑选一个硬件地址和一个IP地址,并且所挑选的两个地址值应使地址解析非常简单。

2.简述ARP发送和接收端的操作过程

发送端:(1)当主机A要发送IP数据包,但查不到目的IP地址对应的MAC地址时,就向网络中ARP请求报文。(2)ARP请求报文中,发送方IP地址和发送方MAC地址为主机A的IP和MAC地址,目标IP地址和目标MAC地址为主机B的IP地址和全0的MAC地址。(3)主机A将ARP报文封装成物理网络中数据帧格式广播发送出去,等待ARP响应。 (4)主机A收到响应报文后,将主机B的MAC地址存入ARP表中,并将IP数据包进行封装发送给主机B。

接收端:(1)主机B接收到ARP报文。(2)主机B从ARP报文中提取出主机A的MAC/IP映射关系,同时更新高速缓存信息。(3)主机B检查ARP报文中的操作域。对于请求报文,如果“目标IP地址”和主机B的IP地址一致,则主机B发送一个ARP响应,将ARP请求报文中的发送端(即主机A)的IP地址和MAC地址存入自己的ARP表中。之后以单播方式发送ARP响应报文给主机A,其中包含了自己的MAC地址;如果不一致,则丢弃。    

3. ICMP对IP数据传输采取了哪些控制措施?

ICMP 大致分成两种功能:差错报告报文和询问报文。(1)确认IP包是否成功到达目标地址 (2)通知在发送过程中IP包被丢弃的原因。

4. 理解TraceRoute和PING的原理。

答:【重点常考题】TraceRoute用于检测数据报能否抵达某个路由器,并计算路径的长度。PING用于检测能否与远程的机器互联互通。

TraceRoute原理:是利用ICMP及IP header的TTL(Time To Live)。首先,traceroute送出一个TTL是1的IP datagram到目的地,当路径上的第一个路由器收到这个datagram时,它将TTL减1。此时,TTL变为0了,所以该路由器会将此datagram丢掉,并送回一个「ICMP time exceeded」消息,traceroute收到这个消息后,便知道这个路由器存在于这个路径上,接着traceroute再送出另一个TTL是2 的datagram,发现第2个路由器...... traceroute每次将送出的datagram的TTL 加1来发现另一个路由器,这个重复的动作一直持续到某个datagram 抵达目的地。

PING原理: Ping使用ICMP回应请求和回应应答报文来实现。当调用ping程序时,它发送一个包含ICMP回应请求的报文给目的地,然后等待一段很短的时间。如果没有收到应答,则重新传送请求。如果重传的请求仍没有收到应答(或收到一个ICMP目的不可达报文),ping声称该远程机器为不可达。远端主机上的ICMP软件应答该回应请求报文。按照协议只要收到回应请求, ICMP软件必须发送回应应答。

5. 考虑如何利用ICMP协议对一个网络上的时延性能进行监控?

ICMP时间戳请求和应答消息都包含发起、接收和传送时间戳。 产生ICMP时间戳请求的主机可以使用这三个时间戳估算远程主机的本地时间。往返时间的值是接收时间值减发起时间值

6. TCP如何考虑数据传输连接的建立和拆除?

建立:

解释一下:SYN是synchronize的缩写,是同步的意思,ACK是Acknowledgment的缩写,是确认的意思,大写的SYN和ACK都是控制信号。seq是sequence的缩写,是序列的意思

答:【面试重点题】TCP连接建立:三次握手     (1) 客户端发出连接请求。由客户端向服务器端发出连接请求,将段的序列号标为x,SYN置1,由于这是双方建立连接过程中发送的第一个包,所以ack(确认字符)无效(ACK=0)。 (2) 服务器端确认连接请求。服务器端接收到客户端的请求后,首先让SYN置1表示同步成功,让ACK置为1表示有效,然后读出序列号seq=x,随即回复序列号为y的包(seq=y),确认号ack=x+1 (3) 客户端对服务器端的连接确认再次做确认。客户端接收到服务器端的连接确认后,对该确认再次作确认,让ACK置1表示有效,客户端收到确认号ack=x+1,序列号seq=z后,发送序列号seq=x+1,确认号ack=y+1的段对连接进行确认。 (4) 服务器端接收到报文后,连接建立。(规律:可以发现确认号ack就是在前面的序列号seq的基础上+1,在前2次握手中会有SYN同步信号,在后2次握手中会有ACK确认号)

拆除:

解释一下:FIN是finish的缩写,代表结束的信号。

TCP连接拆除:四次挥手 (1) 第1次挥手:Host A要求终止连接,先让控制信号FIN置为1表示有效,发送一个序列号seq=u的段,同时确认此前刚收到的最后一段数据。第2次挥手:Host B收到Host A发送的段后,置ACK为1表示有效,发送序列号seq=v,回复确认号ack=u+1,同意关闭连接。此时处于半关闭状态。 (2)第3次挥手:Host B将FIN置为1,表示结束有效,ACK置位1表示确认有效,发送序列号为w的段(seq=w),ack的值仍旧是u+1,这一步的目的是确保客户端也接收到了关闭的请求 (4)Host A收到Host B发送的段后,seq是u+1,发送ack=w+1的确认号,同时关闭连接。(规律:后三次挥手都有ACK确认信号,请求关闭的第1、3次挥手都有FIN结束信号,第2、3次确认号ack的值相同=第4次seq序列号的值)

 7. TCP如何考虑流量控制和拥塞控制?

TCP使用滑动窗口机制来进行流量控制。 (1)当一个连接建立时,连接的每一端分配一个缓冲区来保存输入的数据。 (2)当数据到达时,接收方发送确认ACK,并包含一个窗口通告(剩余的缓冲区空间的数量叫窗口)。 (3)如果发送方收到一个零窗口通告,将停止发送,直到收到一个正的窗口通告。 (4)使用了窗口机制以后,提高了网络的吞吐量。

TCP拥塞控制四个主要过程。 (1)慢启动阶段:发送方将初始拥塞窗口设置为一个较小的值,每当收到一个确认报文段,拥塞窗口大小就会加倍。 (2)拥塞避免阶段:发送方继续以一定的速率增加拥塞窗口的大小,但增长速率会变慢。避免因发送速率过快导致网络拥塞。 (3)快速重传:接收方检测到报文丢失,会发送一个重复确认信号给发送方,报告有报文缺失,然后发送方立即重传。 (4)快速恢复阶段:当发送方连续收到多个重复确认,说明有一些报文段已经丢失或者出现了网络拥塞,因为当拥塞发生时,发送的数据报会被丢弃,这时会执行快速恢复算法,将拥塞窗口减半,设置拥塞阈值为当前窗口一半,然后发送方继续以拥塞避免算法增加窗口大小。

七、第七周:

1.为什么客户发出的控制连接是主动打开,但发出的数据连接是被动打开?

答:因为FTP是client-server模式。 (1)用户运行本地FTP应用程序成为一个客户,调用socket和connect,用TCP与一个远程计算机上的FTP服务器建立控制连接,此时用户是客户端。 (2)传输数据时,由服务器为每个文件传输建立一个单独的数据连接,用于发送文件。而客户端调用socket绑定(bind()方式)调用进行监听。此时用户是服务器。

八、第八周:

2. Into what two conceptual pieces is a modern packet switch divided?   (一个现代的分组交换机分为哪两个概念部分?)

答:① 连接本地计算机的两层交换机。② 连接其他站点的路由器。

(ps:2层交换机是一种网络设备,也称以太网交换机,是在数据链路层工作,根据目标MAC地址将数据帧转发给对应端口,在同一个网络下可以连接对个计算机、服务器、打印机等设备)

3. If a WAN connects N sites, what is the minimum number of digital circuits needed?    What is the maximum number that can be present? (如果一个WAN连接N个站点,至少需要多少条数字电路?最多可以使用多少条?)

答:数字线路的最小数量和最大数量都需要根据网络拓扑和连接要求来确定。 至少N-1条(树形网络);最多N(N-1)/2条(全互连网络)

4.以最少跳数作为最短路径,给出下面图形中所有交换设备的路由表。

(解析:R1、R2...分别代表交换机,目标结点“1”代表去往1号交换机,“-”代表下一跳为当前网络,目标结点“*”代表省略,如对R1来说去往交换机3、4、5都是(1,3)因此为了简化就这样写)

九、第九周:

1.通过图示RIP协议对距离-向量算法的增强过程。

(1) 相同开销路径的处理。 问题:图中,路由器R3、R4对H1的广播都会包含(网络1, 距离=2)的信息,除非被新的更短路径取代或者路径出现异常断路。H1会接收到两个相同的路由向量信息。 解决策略:采取先入为主策略,先到的路由信息直接计算存储到路由表中。如果收到的新路由距离信息和路由表中已有的路由距离信息相等,则直接抛弃,不进行更新路由表操作。

(2) 过时路径的处理。 问题:如果H1中存储去往N1的路由信息为(网络1,距离=2),在P1出现断路的情况下,需要对出错的路由情况进行标记,进行路由的更新。 解决策略:对应每个路由信息设定时钟,用来标记当前路由信息从被更新到目前经历的时间。如果时钟收到当前路由信息的广播信息,则时钟清零。如果时钟一段时间没有收到当前路由信息的广播信息,则删除当前路由条目,等待新的路径广播信息。

 

2.简述RIP/OSPF/BGP协议的原理及其应用。

   

 (1) RIP ① 原理:采用广播或多播方式传送路径信息;支持缺省路由广播,路由器可以对特定外部路由设备指定缺省路由;基于无连接数据报协议(UDP)完成路由信息的发送和接收,速度优先。 ② 应用:RIP协议是最简单的一种动态路由协议。RIP作为一个系统长驻进程而存在于路由器中,负责从网络系统的其他路由器接收路由信息,从而对本地IP层路由表作动态的维护,保证IP层发送报文时选择正确的路由。同时负责广播本路由器的路由信息,通知相邻路由器作相应的修改。

 

(2) OSPF ① 原理: OSPF协议应用于一个自治系统内部 。 支持完整的CIDR的地址表示方法和子网结构,允许地址按照类别或子网两种方式进行目的端路由信息表示 。 采用链路-状态算法进行路由更新,路由传送的信息数据较少,每一台路由设备都需要进行整个自治系统内部的路由状况计算。 对信息做认证处理,确保收到的信息来自确定的合法数据源,增加了安全控制 。 实现了路由翻译过程,能够实现对BGP4等协议进行OSPF的转化,从而可以从其它协议中进行路由学习 。

实现了分层路由能力:提出域(AREA)的概念,一个域可以作为一个自治系统中从地理上或逻辑上进行划分的一个子集。域内部可以采取OSPF或RIP协议,不同域之间采用OSPF协议完成路由。 ② 应用:与RIP相比,OSPF支持在AS中分区域的路由。它支持更大规模的AS路由。

 (3) BGP ① 原理: 自治系统之间的路由协议。采取距离-向量路由算法。提供可靠传输,保证路由信息的准确和完整。负责BGP路由的设备可以动态请求另一自治系统中的路由设备作为自己的外部邻机设备,以便互换路径信息。负责BGP路由的设备不断测试邻机设备状态, 以互换路径信息 ② 应用:BGP是当前全球网络中最重要的EGP。

十一、第十一周:

1. Client-Server模式的产生原因及其功能。

(1)产生原因:互联网系统提供基础的通信服务,但协议软件并不能启动与一台远程计算机的通信,也不能接受一台远程计算机的通信。通信中必须有两个应用程序参加:一个主动地启动通信,另一个被动等待、接受通信。主动的为客户端,被动的为服务器。

(2)功能: ①Client:在用户的pc上本地运行,不需要特殊的硬件,当需要远程连接时主动发起,由用户启动,并且只执行一次对话,可以处理多个服务,但一次只能连接一个远程服务器。 ②Server:在共享计算机上运行,需要强大的硬件支持,系统启动时启动,被动响应远程客户端的请求,可以同时处理多个对话,接受多个客户端的请求,但只能提供一种服务.。

2. Socket接口及其在Client-Server模式中的执行模式。

(1)服务器会创建一个ServerSocket对象。调用bind()方法将一个Socket对象绑定到一个特定的IP地址和端口号上,目的是用来指定监听的IP地址和端口号。然后调用listen()方法用于监听客户端的连接请求。

(2)客户端也会创建一个Socket对象。调用connect()方法指定服务器的IP地址和端口号,用于发起与服务器连接的请求。

(3)服务器当接收到客户端的请求会调用accept()方法,用于接收客户端的连接请求,需要注意的是服务器端的accept()方法会返回一个新的Socket对象,客户端就与这个新的Socket对象通信。

(4)然后服务器和客户端就可以进行通信,Send()是发送数据的输出流,recv是接收数据的输入流。一方发送数据,一方接收数据,循环往复。

(5)最后当数据交互完毕后,调用close()方法断开Socket连接,过程结束。

十二、第十二周:

1. 若已经建立了一条TCP连接,为什么要传送邮件时还要建立一条TCP连接。

因为传送邮件时客户端建立了一个TCP连接到服务器的25号端口请求服务,这个时候服务器如果想让25号端口能继续监听其它客户端的连接请求,就必须要指定一个新的临时端口与客户端进行交互,所以需要再建立一条新的TCP连接。

    

2. 在SMTP中,若在两个用户间只发送1行的报文,则要交换的命令和响应共有多少行。

Server:220 Service Ready        //220服务器准备就绪 
Client:HELO example.com         //HELO客户端标明自己身份
Server:250 OK
Client:MAIL FROM:<Liqi@foobar.com>   //MAIL 本地的邮箱地址
Server:250 OK
Client:RCPT TO:<Liqi2@example. com>  //RCPT 目的地的邮箱地址
Server:250 OK
Client:DATA                          //DATA 告诉服务器:接下来我将发送数据
Server:354 Start mail input; end with <CR><LF>    //服务器说明要求
Client: Hello World!                 //客户端发送数据
Client:<CR><LF>                      //这段字符代表数据结束
Server:250 OK
Client: Quit                         //Quit表示结束会话
Server:221 Service closing           //221是服务关闭

答:交换的命令和响应共有14行。

12.3  一个发信人要发送一个JPEG报文,试给出MIME首部。

MIME-Version:1.0   //版本
Content-Type:Image/JPEG   //内容类型
Content-Transfer-Encoding:base64   //编码格式

12.4  请你的同学配合,在不同地方ping一些门户网站的主机(如www.163.com),查看其 DNS是否指向同一个IP地址,这样做有何好处?(是不是意味着访问不同的内容?)

不同。因为这是DNS轮询的结果。当DNS服务器解析请求时,会按照用户请求的顺序,将这些请求逐一分配到不同的IP上,给不同的服务器处理,避免因单个服务器的负载过大而导致奔溃,实现了负载均衡的功能和高可用性。

十三、第十三周:

1. HTTP的GET方法与POST方法有何区别?

(1) 可见性:Get方式通过URL提交数据,数据附在URL末尾,是可见的;Post方式,数据是防止在请求体中提交,提交时不可见。

(2) 安全性问题。使用 Get方式的时候,数据能被缓存,能保留在浏览器历史记录中,而 Post不会。所以,如果输入的是密码或其它敏感信息时,使用Post更为安全,如果只是发出请求可以用Get方式,而且Get速度更快。

(3) 数据的长度限制:Get方式提交的数据不能多于2048字节(因为URL通常不多于2048字节),而Post没有限制,所以Get方法不适合传输大批量数据。

(4) 数据的类型:Get方式只允许ASCII字符,而Post方式没有限制。

(5) 幂等性:Get方法是幂等的,即多次请求同一个URL返回的结果是一致的,不会对服务器产生副作用。Post方法不是幂等的,多次请求可能会对服务器产生不同的影响。

  

2. 静态文档、动态文档与活动文档有何区别

(1)创建方式不同:静态文档是指内容固定的文档,它是由万维网服务器创建,并存放在其中。动态文档是指文档的内容是在浏览器访问服务器时才得以创建。活动文档是指能够提供了一种连续更新屏幕内容的技术,这种技术把创建文档的工作移到浏览器端进行。

(2)生成方式不同:静态文档的内容是提前编写到文档里的,浏览器每次访问时,里面的内容都不改变。动态文档是通过服务器上运行自己编写的应用程序动态的产生的,文档里的内容是每次访问一更新的。当浏览器请求一个活动文档时,服务器就返回这个活动文档程序的副本或脚本,然后就在浏览器端运行。

(3)内容变化不同:静态文档每次访问时里面的内容都不改变。动态文档每次访问时里面的内容也不一样。活动文档克服了静态文档内容固定不变的不足,但活动文档一旦建立,它所包含的内容也就被固定下来而无法及时刷新。

(4)对创建者要求不同:静态文档的最大优点是简单,文档可以由非程序设计人员来创建。动态文档的创建难度比静态文档要高,因为开发人员必须具有一定的编程能力,编写出用于生成动态文档的应用程序。活动文档程序可与用户直接交互,以便连续地更新屏幕的显示内容。

   

一、第一周:

7.2 What are the three energy types used when classifying physical media according to energy used? ( 7.2 当依据所有能量类型划分物理介质类别时,是指哪三种能量类型?)

答:1、电气能量  2、光  3、无线电波

7.3 What happens when noise encounters a metal object? ( 7.3 当噪声遇到金属物体时会发生什么现象?)

答:当噪声碰到金属的时候,会感应产生微弱信号,随机噪声会干扰通信信号。

7.4 What three types of wiring are used to reduce interference form noise? ( 7.4 请说出用于降低噪声干扰的三种导线类型。)

答:1、无屏蔽双绞线    2、同轴电缆  3、屏蔽双绞线

1. 什么是 RS-232? RS-232 有什么特点?

答:RS-232 是用于计算机与调制解调器、 键盘或终端之类设备之间传输字符的串行接口的一种标准。       它具有的特点:串行,异步,适用于短距离通信(课本原文)   1、RS-232 的电气特性为:-3V~-15V 代表逻辑 1;+3V~+15V 代表逻辑 0;   2、对数据按照位进行序列化发送和接收(串行);   3、发送方和接收方不需要进行同步操作(异步);   4、数据值仅有 0 和 1 两种形式,不出现“空”状态;   5、7 位作为一个发送单元;   6、对应每个数据单元,增加一个“0”作为开始位,“1”作为结束位;   7、接收方接收到有效数据开始位后,严格按照时间片顺序完成数据接收,直到接收完结束位为止;

9.2 What are the advantages of parallel transmission? What is the chief disadvantage? ( 9.2 并行传输的优点是什么?主要缺点是什么?)

答:并行传输的优点:    1、高吞吐量,比串行传输一次可以多传输N个比特的数据    2、与底层硬件相匹配    主要缺点:  1、超高传输速率下,并行导线会出现电磁噪声,干扰其他导线上的信号    2、并行传输严格要求各并行的导线长度恰好一致。几毫米的误差都能导致问题。    3、需要更多的导线,中间电子元件也更贵,成本高。

9.3 When transmitting a 32-bit 2’s complement integer in big-endian order, when is the sign bit transmitted? ( 9.3 以正序传输 32 位的二进制补码整数时,何时发送符号位?)

答:以太网技术规定。字节按正序传输(ps:从左到右),码元按逆序传输(ps:从右到左)。依据字节按正序传输,比特按逆序传输,在第八位时发送符号位。

(ps:假如要传输一个形式数据:0x12345678,根据计组的知识:最左侧是高位字节,最右侧是低位字节。在计算机中,低地址位于左侧,高地址位于右侧,因为这种表示方式与人们阅读习惯相一致,数据发送也是从低地址发送高地址。字节序是大端序,高位字节放在低地址(低地址的数据先发送,所以数据的高位先发送),所以计算机最先收到12,这也是从左到右(以人类阅读数据习惯的方向)的由来。码元序是小端序,低位字节放在低地址(低地址的数据先发送),计算机最先收到78(重申数据的最右侧为低位字节哦!),所以是从右到左。)

(解析:注意符号位是一个位,而不是一个字节。根据计算机组成原理的知识:符号位是在形式数据的最高位,也就是最左边。根据以太网技术,码元是小端序传输,数据的最高位存放在计算机的高地址处,而计算机的高地址是在最右边哦,因此答案是第八位。)

【看懂的点个赞呀!整理不易】

9.6 What is a start bit, and with which type of serial transmission is a start bit used? ( 9.6 开始位是什么?其用于哪种类型的串行传输?)

答: 在发送一个字符的比特之前先发送一个额外的0位,以让接收器知道新的字符从哪里开始,即开始位。开始位用在RS-232异步串行传输。

9.10 Use the Web to find the definition of the DCE and DTE pinouts used on a DB-25 connector. Hint: pins 2 and 3 are transmit or receive. On a DCE type connector, does pin2 transmit or receive? ( 9.10 请上网查找 DB-25 连接器中使用的 DCE 和 DTE 引脚的定义。提示:引脚 2 和引脚 3 用于发送和接收。在 DCE 型连接器中,引脚 2 是用于发送还是接收?)

答: DCE:数据通信设备   DTE:数据终端设备   在DCE型连接器中,引脚2用于发送

(解析:终端设备是像计算机之类的,引脚1用于接收来自终端设备的信号,引脚2用于发送数据到终端设备)

二、第二周:

1. 什么是调制与解调?调制与解调有哪些基本方法?

答:调制:是用基带信号控制载波信号的某个或几个参量的变化,将信息荷载在其上形成已调信号,从而适宜在信道中传输。 解调:是在接收端将已调信号恢复成原始基带信号的过程。 调制技术:调幅、调频、调相。 解调技术:解调幅、解调频、解相位移动调试。

2. 载波复用技术有哪几种?各有什么特点?

答: 1、频分多路复用,特点是把电路或空间的频带资源分为多个频段,并将其分配给多个用户,每个用户终端的数据通过分配给它的子通路传输。主要用于电话和电缆电视系统。    2、时分多路复用,特点是按传输的时间进行分割,将不同信号在不同时间内传送。又包含两种方式:同步时分复用和异步时分复用。    3、波分多路复用,特点是对于光的频分复用。做到用一根光纤来同时传输与多个频率很接近的光波信号。   4、码分多路复用,特点是每个用户可在同一时间使用同样的频带进行通信,是一种共享信道的方法。通信各方面之间不会相互干扰,且抗干扰能力强。

10.1 List the three basic types of analog modulation. 10.1列出模拟调制的三种基本类型。

答:振幅调制、频率调制、移相调制。

10.2 When using amplitude modulation, does it make sense for a 1 Hz carrier to be modulated by a 2 Hz sine wave? Why or why not? (10.2. 当采用调幅时,用2Hz的正弦波去调制1Hz的载波是否有意义?为什么?)

答:(解析:Hz是频率,调幅是幅度,二者无关)无意义。调幅是看正弦波对未调制载波幅度的修改,跟频率无关。(补充:载波频率高低就好像马路的宽度,信号调制速率就好像汽车的宽度。当使用振幅调制时,载波的幅度才能用来传递信息,与频率无关,无意义。当使用频率调制时,调制波的频率需要远大于载波频率。对于AM,载波的振幅按照所需传送信号的变化规律而变化,但频率是保持不变的。)

10.7 Figure 10.9 shows a full-duplex configuration with four wires, two of which are used to transmit in each direction. Argue that it should be possible to use three wires instead. (10.7图10.9表示的4根导线实现全双工配置的方案,每两根用于一个方向的传输。请讨论一下是否有可能改为使用3根导线来实现。

答:可以。一根发送线,一根接收线,还有一根必须的信号地线。三根线就能实现全双工通信。

(补充:信号地线可以提供电磁干扰的屏蔽、提供共同的参考点,并保护设备免受静电损害)

Computer Networking: A Top-Down Approach, 6th Edition Solutions to Review Questions and Problems Version Date: May 2012 This document contains the solutions to review questions and problems for the 5th edition of Computer Networking: A Top-Down Approach by Jim Kurose and Keith Ross. These solutions are being made available to instructors ONLY. Please do NOT copy or distribute this document to others (even other instructors). Please do not post any solutions on a publicly-available Web site. We’ll be happy to provide a copy (up-to-date) of this solution manual ourselves to anyone who asks. Acknowledgments: Over the years, several students and colleagues have helped us prepare this solutions manual. Special thanks goes to HongGang Zhang, Rakesh Kumar, Prithula Dhungel, and Vijay Annapureddy. Also thanks to all the readers who have made suggestions and corrected errors. All material © copyright 1996-2012 by J.F. Kurose and K.W. Ross. All rights reserved Chapter 1 Review Questions There is no difference. Throughout this text, the words “host” and “end system” are used interchangeably. End systems include PCs, workstations, Web servers, mail servers, PDAs, Internet-connected game consoles, etc. From Wikipedia: Diplomatic protocol is commonly described as a set of international courtesy rules. These well-established and time-honored rules have made it easier for nations and people to live and work together. Part of protocol has always been the acknowledgment of the hierarchical standing of all present. Protocol rules are based on the principles of civility. Standards are important for protocols so that people can create networking systems and products that interoperate. 1. Dial-up modem over telephone line: home; 2. DSL over telephone line: home or small office; 3. Cable to HFC: home; 4. 100 Mbps switched Ethernet: enterprise; 5. Wifi (802.11): home and enterprise: 6. 3G and 4G: wide-area wireless. HFC bandwidth is shared among the users. On the downstream channel, all packets emanate from a single source, namely, the head end. Thus, there are no collisions in the downstream channel. In most American cities, the current possibilities include: dial-up; DSL; cable modem; fiber-to-the-home. 7. Ethernet LANs have transmission rates of 10 Mbps, 100 Mbps, 1 Gbps and 10 Gbps. 8. Today, Ethernet most commonly runs over twisted-pair copper wire. It also can run over fibers optic links. 9. Dial up modems: up to 56 Kbps, bandwidth is dedicated; ADSL: up to 24 Mbps downstream and 2.5 Mbps upstream, bandwidth is dedicated; HFC, rates up to 42.8 Mbps and upstream rates of up to 30.7 Mbps, bandwidth is shared. FTTH: 2-10Mbps upload; 10-20 Mbps download; bandwidth is not shared. 10. There are two popular wireless Internet access technologies today: Wifi (802.11) In a wireless LAN, wireless users transmit/receive packets to/from an base station (i.e., wireless access point) within a radius of few tens of meters. The base station is typically connected to the wired Internet and thus serves to connect wireless users to the wired network. 3G and 4G wide-area wireless access networks. In these systems, packets are transmitted over the same wireless infrastructure used for cellular telephony, with the base station thus being managed by a telecommunications provider. This provides wireless access to users within a radius of tens of kilometers of the base station. 11. At time t0 the sending host begins to transmit. At time t1 = L/R1, the sending host completes transmission and the entire packet is received at the router (no propagation delay). Because the router has the entire packet at time t1, it can begin to transmit the packet to the receiving host at time t1. At time t2 = t1 + L/R2, the router completes transmission and the entire packet is received at the receiving host (again, no propagation delay). Thus, the end-to-end delay is L/R1 + L/R2. 12. A circuit-switched network can guarantee a certain amount of end-to-end bandwidth for the duration of a call. Most packet-switched networks today (including the Internet) cannot make any end-to-end guarantees for bandwidth. FDM requires sophisticated analog hardware to shift signal into appropriate frequency bands. 13. a) 2 users can be supported because each user requires half of the link bandwidth. b) Since each user requires 1Mbps when transmitting, if two or fewer users transmit simultaneously, a maximum of 2Mbps will be required. Since the available bandwidth of the shared link is 2Mbps, there will be no queuing delay before the link. Whereas, if three users transmit simultaneously, the bandwidth required will be 3Mbps which is more than the available bandwidth of the shared link. In this case, there will be queuing delay before the link. c) Probability that a given user is transmitting = 0.2 d) Probability that all three users are transmitting simultaneously = = (0.2)3 = 0.008. Since the queue grows when all the users are transmitting, the fraction of time during which the queue grows (which is equal to the probability that all three users are transmitting simultaneously) is 0.008. 14. If the two ISPs do not peer with each other, then when they send traffic to each other they have to send the traffic through a provider ISP (intermediary), to which they have to pay for carrying the traffic. By peering with each other directly, the two ISPs can reduce their payments to their provider ISPs. An Internet Exchange Points (IXP) (typically in a standalone building with its own switches) is a meeting point where multiple ISPs can connect and/or peer together. An ISP earns its money by charging each of the the ISPs that connect to the IXP a relatively small fee, which may depend on the amount of traffic sent to or received from the IXP. 15. Google's private network connects together all its data centers, big and small. Traffic between the Google data centers passes over its private network rather than over the public Internet. Many of these data centers are located in, or close to, lower tier ISPs. Therefore, when Google delivers content to a user, it often can bypass higher tier ISPs. What motivates content providers to create these networks? First, the content provider has more control over the user experience, since it has to use few intermediary ISPs. Second, it can save money by sending less traffic into provider networks. Third, if ISPs decide to charge more money to highly profitable content providers (in countries where net neutrality doesn't apply), the content providers can avoid these extra payments. 16. The delay components are processing delays, transmission delays, propagation delays, and queuing delays. All of these delays are fixed, except for the queuing delays, which are variable. 17. a) 1000 km, 1 Mbps, 100 bytes b) 100 km, 1 Mbps, 100 bytes 18. 10msec; d/s; no; no 19. a) 500 kbps b) 64 seconds c) 100kbps; 320 seconds 20. End system A breaks the large file into chunks. It adds header to each chunk, thereby generating multiple packets from the file. The header in each packet includes the IP address of the destination (end system B). The packet switch uses the destination IP address in the packet to determine the outgoing link. Asking which road to take is analogous to a packet asking which outgoing link it should be forwarded on, given the packet’s destination address. 21. The maximum emission rate is 500 packets/sec and the maximum transmission rate is 350 packets/sec. The corresponding traffic intensity is 500/350 =1.43 > 1. Loss will eventually occur for each experiment; but the time when loss first occurs will be different from one experiment to the next due to the randomness in the emission process. 22. Five generic tasks are error control, flow control, segmentation and reassembly, multiplexing, and connection setup. Yes, these tasks can be duplicated at different layers. For example, error control is often provided at more than one layer. 23. The five layers in the Internet protocol stack are – from top to bottom – the application layer, the transport layer, the network layer, the link layer, and the physical layer. The principal responsibilities are outlined in Section 1.5.1. 24. Application-layer message: data which an application wants to send and passed onto the transport layer; transport-layer segment: generated by the transport layer and encapsulates application-layer message with transport layer header; network-layer datagram: encapsulates transport-layer segment with a network-layer header; link-layer frame: encapsulates network-layer datagram with a link-layer header. 25. Routers process network, link and physical layers (layers 1 through 3). (This is a little bit of a white lie, as modern routers sometimes act as firewalls or caching components, and process Transport layer as well.) Link layer switches process link and physical layers (layers 1 through2). Hosts process all five layers. 26. a) Virus Requires some form of human interaction to spread. Classic example: E-mail viruses. b) Worms No user replication needed. Worm in infected host scans IP addresses and port numbers, looking for vulnerable processes to infect. 27. Creation of a botnet requires an attacker to find vulnerability in some application or system (e.g. exploiting the buffer overflow vulnerability that might exist in an application). After finding the vulnerability, the attacker needs to scan for hosts that are vulnerable. The target is basically to compromise a series of systems by exploiting that particular vulnerability. Any system that is part of the botnet can automatically scan its environment and propagate by exploiting the vulnerability. An important property of such botnets is that the originator of the botnet can remotely control and issue commands to all the nodes in the botnet. Hence, it becomes possible for the attacker to issue a command to all the nodes, that target a single node (for example, all nodes in the botnet might be commanded by the attacker to send a TCP SYN message to the target, which might result in a TCP SYN flood attack at the target). 28. Trudy can pretend to be Bob to Alice (and vice-versa) and partially or completely modify the message(s) being sent from Bob to Alice. For example, she can easily change the phrase “Alice, I owe you $1000” to “Alice, I owe you $10,000”. Furthermore, Trudy can even drop the packets that are being sent by Bob to Alice (and vise-versa), even if the packets from Bob to Alice are encrypted. Chapter 1 Problems Problem 1 There is no single right answer to this question. Many protocols would do the trick. Here's a simple answer below: Messages from ATM machine to Server Msg name purpose -------- ------- HELO Let server know that there is a card in the ATM machine ATM card transmits user ID to Server PASSWD User enters PIN, which is sent to server BALANCE User requests balance WITHDRAWL User asks to withdraw money BYE user all done Messages from Server to ATM machine (display) Msg name purpose -------- ------- PASSWD Ask user for PIN (password) OK last requested operation (PASSWD, WITHDRAWL) OK ERR last requested operation (PASSWD, WITHDRAWL) in ERROR AMOUNT sent in response to BALANCE request BYE user done, display welcome screen at ATM Correct operation: client server HELO (userid) --------------> (check if valid userid) <------------- PASSWD PASSWD --------------> (check password) <------------- AMOUNT WITHDRAWL --------------> check if enough $ to cover withdrawl (check if valid userid) <------------- PASSWD PASSWD --------------> (check password) <------------- AMOUNT WITHDRAWL --------------> check if enough $ to cover withdrawl <------------- BYE Problem 2 At time N*(L/R) the first packet has reached the destination, the second packet is stored in the last router, the third packet is stored in the next-to-last router, etc. At time N*(L/R) + L/R, the second packet has reached the destination, the third packet is stored in the last router, etc. Continuing with this logic, we see that at time N*(L/R) + (P-1)*(L/R) = (N+P-1)*(L/R) all packets have reached the destination. Problem 3 a) A circuit-switched network would be well suited to the application, because the application involves long sessions with predictable smooth bandwidth requirements. Since the transmission rate is known and not bursty, bandwidth can be reserved for each application session without significant waste. In addition, the overhead costs of setting up and tearing down connections are amortized over the lengthy duration of a typical application session. b) In the worst case, all the applications simultaneously transmit over one or more network links. However, since each link has sufficient bandwidth to handle the sum of all of the applications' data rates, no congestion (very little queuing) will occur. Given such generous link capacities, the network does not need congestion control mechanisms. Problem 4 Between the switch in the upper left and the switch in the upper right we can have 4 connections. Similarly we can have four connections between each of the 3 other pairs of adjacent switches. Thus, this network can support up to 16 connections. We can 4 connections passing through the switch in the upper-right-hand corner and another 4 connections passing through the switch in the lower-left-hand corner, giving a total of 8 connections. Yes. For the connections between A and C, we route two connections through B and two connections through D. For the connections between B and D, we route two connections through A and two connections through C. In this manner, there are at most 4 connections passing through any link. Problem 5 Tollbooths are 75 km apart, and the cars propagate at 100km/hr. A tollbooth services a car at a rate of one car every 12 seconds. a) There are ten cars. It takes 120 seconds, or 2 minutes, for the first tollbooth to service the 10 cars. Each of these cars has a propagation delay of 45 minutes (travel 75 km) before arriving at the second tollbooth. Thus, all the cars are lined up before the second tollbooth after 47 minutes. The whole process repeats itself for traveling between the second and third tollbooths. It also takes 2 minutes for the third tollbooth to service the 10 cars. Thus the total delay is 96 minutes. b) Delay between tollbooths is 8*12 seconds plus 45 minutes, i.e., 46 minutes and 36 seconds. The total delay is twice this amount plus 8*12 seconds, i.e., 94 minutes and 48 seconds. Problem 6 a) seconds. b) seconds. c) seconds. d) The bit is just leaving Host A. e) The first bit is in the link and has not reached Host B. f) The first bit has reached Host B. g) Want km. Problem 7 Consider the first bit in a packet. Before this bit can be transmitted, all of the bits in the packet must be generated. This requires sec=7msec. The time required to transmit the packet is sec= sec. Propagation delay = 10 msec. The delay until decoding is 7msec + sec + 10msec = 17.224msec A similar analysis shows that all bits experience a delay of 17.224 msec. Problem 8 a) 20 users can be supported. b) . c) . d) . We use the central limit theorem to approximate this probability. Let be independent random variables such that . “21 or more users” when is a standard normal r.v. Thus “21 or more users” . Problem 9 10,000 Problem 10 The first end system requires L/R1 to transmit the packet onto the first link; the packet propagates over the first link in d1/s1; the packet switch adds a processing delay of dproc; after receiving the entire packet, the packet switch connecting the first and the second link requires L/R2 to transmit the packet onto the second link; the packet propagates over the second link in d2/s2. Similarly, we can find the delay caused by the second switch and the third link: L/R3, dproc, and d3/s3. Adding these five delays gives dend-end = L/R1 + L/R2 + L/R3 + d1/s1 + d2/s2 + d3/s3+ dproc+ dproc To answer the second question, we simply plug the values into the equation to get 6 + 6 + 6 + 20+16 + 4 + 3 + 3 = 64 msec. Problem 11 Because bits are immediately transmitted, the packet switch does not introduce any delay; in particular, it does not introduce a transmission delay. Thus, dend-end = L/R + d1/s1 + d2/s2+ d3/s3 For the values in Problem 10, we get 6 + 20 + 16 + 4 = 46 msec. Problem 12 The arriving packet must first wait for the link to transmit 4.5 *1,500 bytes = 6,750 bytes or 54,000 bits. Since these bits are transmitted at 2 Mbps, the queuing delay is 27 msec. Generally, the queuing delay is (nL + (L - x))/R. Problem 13 The queuing delay is 0 for the first transmitted packet, L/R for the second transmitted packet, and generally, (n-1)L/R for the nth transmitted packet. Thus, the average delay for the N packets is: (L/R + 2L/R + ....... + (N-1)L/R)/N = L/(RN) * (1 + 2 + ..... + (N-1)) = L/(RN) * N(N-1)/2 = LN(N-1)/(2RN) = (N-1)L/(2R) Note that here we used the well-known fact: 1 + 2 + ....... + N = N(N+1)/2 It takes seconds to transmit the packets. Thus, the buffer is empty when a each batch of packets arrive. Thus, the average delay of a packet across all batches is the average delay within one batch, i.e., (N-1)L/2R. Problem 14 The transmission delay is . The total delay is Let . Total delay = For x=0, the total delay =0; as we increase x, total delay increases, approaching infinity as x approaches 1/a. Problem 15 Total delay . Problem 16 The total number of packets in the system includes those in the buffer and the packet that is being transmitted. So, N=10+1. Because , so (10+1)=a*(queuing delay + transmission delay). That is, 11=a*(0.01+1/100)=a*(0.01+0.01). Thus, a=550 packets/sec. Problem 17 There are nodes (the source host and the routers). Let denote the processing delay at the th node. Let be the transmission rate of the th link and let . Let be the propagation delay across the th link. Then . Let denote the average queuing delay at node . Then . Problem 18 On linux you can use the command traceroute www.targethost.com and in the Windows command prompt you can use tracert www.targethost.com In either case, you will get three delay measurements. For those three measurements you can calculate the mean and standard deviation. Repeat the experiment at different times of the day and comment on any changes. Here is an example solution: Traceroutes between San Diego Super Computer Center and www.poly.edu The average (mean) of the round-trip delays at each of the three hours is 71.18 ms, 71.38 ms and 71.55 ms, respectively. The standard deviations are 0.075 ms, 0.21 ms, 0.05 ms, respectively. In this example, the traceroutes have 12 routers in the path at each of the three hours. No, the paths didn’t change during any of the hours. Traceroute packets passed through four ISP networks from source to destination. Yes, in this experiment the largest delays occurred at peering interfaces between adjacent ISPs. Traceroutes from www.stella-net.net (France) to www.poly.edu (USA). The average round-trip delays at each of the three hours are 87.09 ms, 86.35 ms and 86.48 ms, respectively. The standard deviations are 0.53 ms, 0.18 ms, 0.23 ms, respectively. In this example, there are 11 routers in the path at each of the three hours. No, the paths didn’t change during any of the hours. Traceroute packets passed three ISP networks from source to destination. Yes, in this experiment the largest delays occurred at peering interfaces between adjacent ISPs. Problem 19 An example solution: Traceroutes from two different cities in France to New York City in United States In these traceroutes from two different cities in France to the same destination host in United States, seven links are in common including the transatlantic link. In this example of traceroutes from one city in France and from another city in Germany to the same host in United States, three links are in common including the transatlantic link. Traceroutes to two different cities in China from same host in United States Five links are common in the two traceroutes. The two traceroutes diverge before reaching China Problem 20 Throughput = min{Rs, Rc, R/M} Problem 21 If only use one path, the max throughput is given by: . If use all paths, the max throughput is given by . Problem 22 Probability of successfully receiving a packet is: ps= (1-p)N. The number of transmissions needed to be performed until the packet is successfully received by the client is a geometric random variable with success probability ps. Thus, the average number of transmissions needed is given by: 1/ps . Then, the average number of re-transmissions needed is given by: 1/ps -1. Problem 23 Let’s call the first packet A and call the second packet B. If the bottleneck link is the first link, then packet B is queued at the first link waiting for the transmission of packet A. So the packet inter-arrival time at the destination is simply L/Rs. If the second link is the bottleneck link and both packets are sent back to back, it must be true that the second packet arrives at the input queue of the second link before the second link finishes the transmission of the first packet. That is, L/Rs + L/Rs + dprop = L/Rs + dprop + L/Rc Thus, the minimum value of T is L/Rc  L/Rs . Problem 24 40 terabytes = 40 * 1012 * 8 bits. So, if using the dedicated link, it will take 40 * 1012 * 8 / (100 *106 ) =3200000 seconds = 37 days. But with FedEx overnight delivery, you can guarantee the data arrives in one day, and it should cost less than $100. Problem 25 160,000 bits 160,000 bits The bandwidth-delay product of a link is the maximum number of bits that can be in the link. the width of a bit = length of link / bandwidth-delay product, so 1 bit is 125 meters long, which is longer than a football field s/R Problem 26 s/R=20000km, then R=s/20000km= 2.5*108/(2*107)= 12.5 bps Problem 27 80,000,000 bits 800,000 bits, this is because that the maximum number of bits that will be in the link at any given time = min(bandwidth delay product, packet size) = 800,000 bits. .25 meters Problem 28 ttrans + tprop = 400 msec + 80 msec = 480 msec. 20 * (ttrans + 2 tprop) = 20*(20 msec + 80 msec) = 2 sec. Breaking up a file takes longer to transmit because each data packet and its corresponding acknowledgement packet add their own propagation delays. Problem 29 Recall geostationary satellite is 36,000 kilometers away from earth surface. 150 msec 1,500,000 bits 600,000,000 bits Problem 30 Let’s suppose the passenger and his/her bags correspond to the data unit arriving to the top of the protocol stack. When the passenger checks in, his/her bags are checked, and a tag is attached to the bags and ticket. This is additional information added in the Baggage layer if Figure 1.20 that allows the Baggage layer to implement the service or separating the passengers and baggage on the sending side, and then reuniting them (hopefully!) on the destination side. When a passenger then passes through security and additional stamp is often added to his/her ticket, indicating that the passenger has passed through a security check. This information is used to ensure (e.g., by later checks for the security information) secure transfer of people. Problem 31 Time to send message from source host to first packet switch = With store-and-forward switching, the total time to move message from source host to destination host = Time to send 1st packet from source host to first packet switch = . . Time at which 2nd packet is received at the first switch = time at which 1st packet is received at the second switch = Time at which 1st packet is received at the destination host = . After this, every 5msec one packet will be received; thus time at which last (800th) packet is received = . It can be seen that delay in using message segmentation is significantly less (almost 1/3rd). Without message segmentation, if bit errors are not tolerated, if there is a single bit error, the whole message has to be retransmitted (rather than a single packet). Without message segmentation, huge packets (containing HD videos, for example) are sent into the network. Routers have to accommodate these huge packets. Smaller packets have to queue behind enormous packets and suffer unfair delays. Packets have to be put in sequence at the destination. Message segmentation results in many smaller packets. Since header size is usually the same for all packets regardless of their size, with message segmentation the total amount of header bytes is more. Problem 32 Yes, the delays in the applet correspond to the delays in the Problem 31.The propagation delays affect the overall end-to-end delays both for packet switching and message switching equally. Problem 33 There are F/S packets. Each packet is S=80 bits. Time at which the last packet is received at the first router is sec. At this time, the first F/S-2 packets are at the destination, and the F/S-1 packet is at the second router. The last packet must then be transmitted by the first router and the second router, with each transmission taking sec. Thus delay in sending the whole file is To calculate the value of S which leads to the minimum delay, Problem 34 The circuit-switched telephone networks and the Internet are connected together at "gateways". When a Skype user (connected to the Internet) calls an ordinary telephone, a circuit is established between a gateway and the telephone user over the circuit switched network. The skype user's voice is sent in packets over the Internet to the gateway. At the gateway, the voice signal is reconstructed and then sent over the circuit. In the other direction, the voice signal is sent over the circuit switched network to the gateway. The gateway packetizes the voice signal and sends the voice packets to the Skype user.   Chapter 2 Review Questions The Web: HTTP; file transfer: FTP; remote login: Telnet; e-mail: SMTP; BitTorrent file sharing: BitTorrent protocol Network architecture refers to the organization of the communication process into layers (e.g., the five-layer Internet architecture). Application architecture, on the other hand, is designed by an application developer and dictates the broad structure of the application (e.g., client-server or P2P). The process which initiates the communication is the client; the process that waits to be contacted is the server. No. In a P2P file-sharing application, the peer that is receiving a file is typically the client and the peer that is sending the file is typically the server. The IP address of the destination host and the port number of the socket in the destination process. You would use UDP. With UDP, the transaction can be completed in one roundtrip time (RTT) - the client sends the transaction request into a UDP socket, and the server sends the reply back to the client's UDP socket. With TCP, a minimum of two RTTs are needed - one to set-up the TCP connection, and another for the client to send the request, and for the server to send back the reply. One such example is remote word processing, for example, with Google docs. However, because Google docs runs over the Internet (using TCP), timing guarantees are not provided. a) Reliable data transfer TCP provides a reliable byte-stream between client and server but UDP does not. b) A guarantee that a certain value for throughput will be maintained Neither c) A guarantee that data will be delivered within a specified amount of time Neither d) Confidentiality (via encryption) Neither SSL operates at the application layer. The SSL socket takes unencrypted data from the application layer, encrypts it and then passes it to the TCP socket. If the application developer wants TCP to be enhanced with SSL, she has to include the SSL code in the application. A protocol uses handshaking if the two communicating entities first exchange control packets before sending data to each other. SMTP uses handshaking at the application layer whereas HTTP does not. The applications associated with those protocols require that all application data be received in the correct order and without gaps. TCP provides this service whereas UDP does not. When the user first visits the site, the server creates a unique identification number, creates an entry in its back-end database, and returns this identification number as a cookie number. This cookie number is stored on the user’s host and is managed by the browser. During each subsequent visit (and purchase), the browser sends the cookie number back to the site. Thus the site knows when this user (more precisely, this browser) is visiting the site. Web caching can bring the desired content “closer” to the user, possibly to the same LAN to which the user’s host is connected. Web caching can reduce the delay for all objects, even objects that are not cached, since caching reduces the traffic on links. Telnet is not available in Windows 7 by default. to make it available, go to Control Panel, Programs and Features, Turn Windows Features On or Off, Check Telnet client. To start Telnet, in Windows command prompt, issue the following command > telnet webserverver 80 where "webserver" is some webserver. After issuing the command, you have established a TCP connection between your client telnet program and the web server. Then type in an HTTP GET message. An example is given below: Since the index.html page in this web server was not modified since Fri, 18 May 2007 09:23:34 GMT, and the above commands were issued on Sat, 19 May 2007, the server returned "304 Not Modified". Note that the first 4 lines are the GET message and header lines inputed by the user, and the next 4 lines (starting from HTTP/1.1 304 Not Modified) is the response from the web server. FTP uses two parallel TCP connections, one connection for sending control information (such as a request to transfer a file) and another connection for actually transferring the file. Because the control information is not sent over the same connection that the file is sent over, FTP sends control information out of band. The message is first sent from Alice’s host to her mail server over HTTP. Alice’s mail server then sends the message to Bob’s mail server over SMTP. Bob then transfers the message from his mail server to his host over POP3. 17. Received: from 65.54.246.203 (EHLO bay0-omc3-s3.bay0.hotmail.com) (65.54.246.203) by mta419.mail.mud.yahoo.com with SMTP; Sat, 19 May 2007 16:53:51 -0700 Received: from hotmail.com ([65.55.135.106]) by bay0-omc3-s3.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Sat, 19 May 2007 16:52:42 -0700 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sat, 19 May 2007 16:52:41 -0700 Message-ID: Received: from 65.55.135.123 by by130fd.bay130.hotmail.msn.com with HTTP; Sat, 19 May 2007 23:52:36 GMT From: "prithula dhungel" To: prithula@yahoo.com Bcc: Subject: Test mail Date: Sat, 19 May 2007 23:52:36 +0000 Mime-Version: 1.0 Content-Type: Text/html; format=flowed Return-Path: prithuladhungel@hotmail.com Figure: A sample mail message header Received: This header field indicates the sequence in which the SMTP servers send and receive the mail message including the respective timestamps. In this example there are 4 “Received:” header lines. This means the mail message passed through 5 different SMTP servers before being delivered to the receiver’s mail box. The last (forth) “Received:” header indicates the mail message flow from the SMTP server of the sender to the second SMTP server in the chain of servers. The sender’s SMTP server is at address 65.55.135.123 and the second SMTP server in the chain is by130fd.bay130.hotmail.msn.com. The third “Received:” header indicates the mail message flow from the second SMTP server in the chain to the third server, and so on. Finally, the first “Received:” header indicates the flow of the mail messages from the forth SMTP server to the last SMTP server (i.e. the receiver’s mail server) in the chain. Message-id: The message has been given this number BAY130-F26D9E35BF59E0D18A819AFB9310@phx.gbl (by bay0-omc3-s3.bay0.hotmail.com. Message-id is a unique string assigned by the mail system when the message is first created. From: This indicates the email address of the sender of the mail. In the given example, the sender is “prithuladhungel@hotmail.com” To: This field indicates the email address of the receiver of the mail. In the example, the receiver is “prithula@yahoo.com” Subject: This gives the subject of the mail (if any specified by the sender). In the example, the subject specified by the sender is “Test mail” Date: The date and time when the mail was sent by the sender. In the example, the sender sent the mail on 19th May 2007, at time 23:52:36 GMT. Mime-version: MIME version used for the mail. In the example, it is 1.0. Content-type: The type of content in the body of the mail message. In the example, it is “text/html”. Return-Path: This specifies the email address to which the mail will be sent if the receiver of this mail wants to reply to the sender. This is also used by the sender’s mail server for bouncing back undeliverable mail messages of mailer-daemon error messages. In the example, the return path is “prithuladhungel@hotmail.com”. With download and delete, after a user retrieves its messages from a POP server, the messages are deleted. This poses a problem for the nomadic user, who may want to access the messages from many different machines (office PC, home PC, etc.). In the download and keep configuration, messages are not deleted after the user retrieves the messages. This can also be inconvenient, as each time the user retrieves the stored messages from a new machine, all of non-deleted messages will be transferred to the new machine (including very old messages). Yes an organization’s mail server and Web server can have the same alias for a host name. The MX record is used to map the mail server’s host name to its IP address. You should be able to see the sender's IP address for a user with an .edu email address. But you will not be able to see the sender's IP address if the user uses a gmail account. It is not necessary that Bob will also provide chunks to Alice. Alice has to be in the top 4 neighbors of Bob for Bob to send out chunks to her; this might not occur even if Alice provides chunks to Bob throughout a 30-second interval. Recall that in BitTorrent, a peer picks a random peer and optimistically unchokes the peer for a short period of time. Therefore, Alice will eventually be optimistically unchoked by one of her neighbors, during which time she will receive chunks from that neighbor. The overlay network in a P2P file sharing system consists of the nodes participating in the file sharing system and the logical links between the nodes. There is a logical link (an “edge” in graph theory terms) from node A to node B if there is a semi-permanent TCP connection between A and B. An overlay network does not include routers. Mesh DHT: The advantage is in order to a route a message to the peer (with ID) that is closest to the key, only one hop is required; the disadvantage is that each peer must track all other peers in the DHT. Circular DHT: the advantage is that each peer needs to track only a few other peers; the disadvantage is that O(N) hops are needed to route a message to the peer that is closest to the key. 25. File Distribution Instant Messaging Video Streaming Distributed Computing With the UDP server, there is no welcoming socket, and all data from different clients enters the server through this one socket. With the TCP server, there is a welcoming socket, and each time a client initiates a connection to the server, a new socket is created. Thus, to support n simultaneous connections, the server would need n+1 sockets. For the TCP application, as soon as the client is executed, it attempts to initiate a TCP connection with the server. If the TCP server is not running, then the client will fail to make a connection. For the UDP application, the client does not initiate connections (or attempt to communicate with the UDP server) immediately upon execution Chapter 2 Problems Problem 1 a) F b) T c) F d) F e) F Problem 2 Access control commands: USER, PASS, ACT, CWD, CDUP, SMNT, REIN, QUIT. Transfer parameter commands: PORT, PASV, TYPE STRU, MODE. Service commands: RETR, STOR, STOU, APPE, ALLO, REST, RNFR, RNTO, ABOR, DELE, RMD, MRD, PWD, LIST, NLST, SITE, SYST, STAT, HELP, NOOP. Problem 3 Application layer protocols: DNS and HTTP Transport layer protocols: UDP for DNS; TCP for HTTP Problem 4 The document request was http://gaia.cs.umass.edu/cs453/index.html. The Host : field indicates the server's name and /cs453/index.html indicates the file name. The browser is running HTTP version 1.1, as indicated just before the first pair. The browser is requesting a persistent connection, as indicated by the Connection: keep-alive. This is a trick question. This information is not contained in an HTTP message anywhere. So there is no way to tell this from looking at the exchange of HTTP messages alone. One would need information from the IP datagrams (that carried the TCP segment that carried the HTTP GET request) to answer this question. Mozilla/5.0. The browser type information is needed by the server to send different versions of the same object to different types of browsers. Problem 5 The status code of 200 and the phrase OK indicate that the server was able to locate the document successfully. The reply was provided on Tuesday, 07 Mar 2008 12:39:45 Greenwich Mean Time. The document index.html was last modified on Saturday 10 Dec 2005 18:27:46 GMT. There are 3874 bytes in the document being returned. The first five bytes of the returned document are : <!doc. The server agreed to a persistent connection, as indicated by the Connection: Keep-Alive field Problem 6 Persistent connections are discussed in section 8 of RFC 2616 (the real goal of this question was to get you to retrieve and read an RFC). Sections 8.1.2 and 8.1.2.1 of the RFC indicate that either the client or the server can indicate to the other that it is going to close the persistent connection. It does so by including the connection-token "close" in the Connection-header field of the http request/reply. HTTP does not provide any encryption services. (From RFC 2616) “Clients that use persistent connections should limit the number of simultaneous connections that they maintain to a given server. A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy.” Yes. (From RFC 2616) “A client might have started to send a new request at the same time that the server has decided to close the "idle" connection. From the server's point of view, the connection is being closed while it was idle, but from the client's point of view, a request is in progress.” Problem 7 The total amount of time to get the IP address is . Once the IP address is known, elapses to set up the TCP connection and another elapses to request and receive the small object. The total response time is Problem 8 . . Problem 9 The time to transmit an object of size L over a link or rate R is L/R. The average time is the average size of the object divided by R:  = (850,000 bits)/(15,000,000 bits/sec) = .0567 sec The traffic intensity on the link is given by =(16 requests/sec)(.0567 sec/request) = 0.907. Thus, the average access delay is (.0567 sec)/(1 - .907)  .6 seconds. The total average response time is therefore .6 sec + 3 sec = 3.6 sec. The traffic intensity on the access link is reduced by 60% since the 60% of the requests are satisfied within the institutional network. Thus the average access delay is (.0567 sec)/[1 – (.4)(.907)] = .089 seconds. The response time is approximately zero if the request is satisfied by the cache (which happens with probability .6); the average response time is .089 sec + 3 sec = 3.089 sec for cache misses (which happens 40% of the time). So the average response time is (.6)(0 sec) + (.4)(3.089 sec) = 1.24 seconds. Thus the average response time is reduced from 3.6 sec to 1.24 sec. Problem 10 Note that each downloaded object can be completely put into one data packet. Let Tp denote the one-way propagation delay between the client and the server. First consider parallel downloads using non-persistent connections. Parallel downloads would allow 10 connections to share the 150 bits/sec bandwidth, giving each just 15 bits/sec. Thus, the total time needed to receive all objects is given by: (200/150+Tp + 200/150 +Tp + 200/150+Tp + 100,000/150+ Tp ) + (200/(150/10)+Tp + 200/(150/10) +Tp + 200/(150/10)+Tp + 100,000/(150/10)+ Tp ) = 7377 + 8*Tp (seconds) Now consider a persistent HTTP connection. The total time needed is given by: (200/150+Tp + 200/150 +Tp + 200/150+Tp + 100,000/150+ Tp ) + 10*(200/150+Tp + 100,000/150+ Tp ) =7351 + 24*Tp (seconds) Assuming the speed of light is 300*106 m/sec, then Tp=10/(300*106)=0.03 microsec. Tp is therefore negligible compared with transmission delay. Thus, we see that persistent HTTP is not significantly faster (less than 1 percent) than the non-persistent case with parallel download. Problem 11 Yes, because Bob has more connections, he can get a larger share of the link bandwidth. Yes, Bob still needs to perform parallel downloads; otherwise he will get less bandwidth than the other four users. Problem 12 Server.py from socket import * serverPort=12000 serverSocket=socket(AF_INET,SOCK_STREAM) serverSocket.bind(('',serverPort)) serverSocket.listen(1) connectionSocket, addr = serverSocket.accept() while 1: sentence = connectionSocket.recv(1024) print 'From Server:', sentence, '\n' serverSocket.close() Problem 13 The MAIL FROM: in SMTP is a message from the SMTP client that identifies the sender of the mail message to the SMTP server. The From: on the mail message itself is NOT an SMTP message, but rather is just a line in the body of the mail message. Problem 14 SMTP uses a line containing only a period to mark the end of a message body. HTTP uses “Content-Length header field” to indicate the length of a message body. No, HTTP cannot use the method used by SMTP, because HTTP message could be binary data, whereas in SMTP, the message body must be in 7-bit ASCII format. Problem 15 MTA stands for Mail Transfer Agent. A host sends the message to an MTA. The message then follows a sequence of MTAs to reach the receiver’s mail reader. We see that this spam message follows a chain of MTAs. An honest MTA should report where it receives the message. Notice that in this message, “asusus-4b96 ([58.88.21.177])” does not report from where it received the email. Since we assume only the originator is dishonest, so “asusus-4b96 ([58.88.21.177])” must be the originator. Problem 16 UIDL abbreviates “unique-ID listing”. When a POP3 client issues the UIDL command, the server responds with the unique message ID for all of the messages present in the user's mailbox. This command is useful for “download and keep”. By maintaining a file that lists the messages retrieved during earlier sessions, the client can use the UIDL command to determine which messages on the server have already been seen. Problem 17 a) C: dele 1 C: retr 2 S: (blah blah … S: ………..blah) S: . C: dele 2 C: quit S: +OK POP3 server signing off b) C: retr 2 S: blah blah … S: ………..blah S: . C: quit S: +OK POP3 server signing off C: list S: 1 498 S: 2 912 S: . C: retr 1 S: blah ….. S: ….blah S: . C: retr 2 S: blah blah … S: ………..blah S: . C: quit S: +OK POP3 server signing off Problem 18 For a given input of domain name (such as ccn.com), IP address or network administrator name, the whois database can be used to locate the corresponding registrar, whois server, DNS server, and so on. NS4.YAHOO.COM from www.register.com; NS1.MSFT.NET from ww.register.com Local Domain: www.mindspring.com Web servers : www.mindspring.com 207.69.189.21, 207.69.189.22, 207.69.189.23, 207.69.189.24, 207.69.189.25, 207.69.189.26, 207.69.189.27, 207.69.189.28 Mail Servers : mx1.mindspring.com (207.69.189.217) mx2.mindspring.com (207.69.189.218) mx3.mindspring.com (207.69.189.219) mx4.mindspring.com (207.69.189.220) Name Servers: itchy.earthlink.net (207.69.188.196) scratchy.earthlink.net (207.69.188.197) www.yahoo.com Web Servers: www.yahoo.com (216.109.112.135, 66.94.234.13) Mail Servers: a.mx.mail.yahoo.com (209.191.118.103) b.mx.mail.yahoo.com (66.196.97.250) c.mx.mail.yahoo.com (68.142.237.182, 216.39.53.3) d.mx.mail.yahoo.com (216.39.53.2) e.mx.mail.yahoo.com (216.39.53.1) f.mx.mail.yahoo.com (209.191.88.247, 68.142.202.247) g.mx.mail.yahoo.com (209.191.88.239, 206.190.53.191) Name Servers: ns1.yahoo.com (66.218.71.63) ns2.yahoo.com (68.142.255.16) ns3.yahoo.com (217.12.4.104) ns4.yahoo.com (68.142.196.63) ns5.yahoo.com (216.109.116.17) ns8.yahoo.com (202.165.104.22) ns9.yahoo.com (202.160.176.146) www.hotmail.com Web Servers: www.hotmail.com (64.4.33.7, 64.4.32.7) Mail Servers: mx1.hotmail.com (65.54.245.8, 65.54.244.8, 65.54.244.136) mx2.hotmail.com (65.54.244.40, 65.54.244.168, 65.54.245.40) mx3.hotmail.com (65.54.244.72, 65.54.244.200, 65.54.245.72) mx4.hotmail.com (65.54.244.232, 65.54.245.104, 65.54.244.104) Name Servers: ns1.msft.net (207.68.160.190) ns2.msft.net (65.54.240.126) ns3.msft.net (213.199.161.77) ns4.msft.net (207.46.66.126) ns5.msft.net (65.55.238.126) d) The yahoo web server has multiple IP addresses www.yahoo.com (216.109.112.135, 66.94.234.13) e) The address range for Polytechnic University: 128.238.0.0 – 128.238.255.255 f) An attacker can use the whois database and nslookup tool to determine the IP address ranges, DNS server addresses, etc., for the target institution. By analyzing the source address of attack packets, the victim can use whois to obtain information about domain from which the attack is coming and possibly inform the administrators of the origin domain. Problem 19 The following delegation chain is used for gaia.cs.umass.edu a.root-servers.net E.GTLD-SERVERS.NET ns1.umass.edu(authoritative) First command: dig +norecurse @a.root-servers.net any gaia.cs.umass.edu ;; AUTHORITY SECTION: edu. 172800 IN NS E.GTLD-SERVERS.NET. edu. 172800 IN NS A.GTLD-SERVERS.NET. edu. 172800 IN NS G3.NSTLD.COM. edu. 172800 IN NS D.GTLD-SERVERS.NET. edu. 172800 IN NS H3.NSTLD.COM. edu. 172800 IN NS L3.NSTLD.COM. edu. 172800 IN NS M3.NSTLD.COM. edu. 172800 IN NS C.GTLD-SERVERS.NET. Among all returned edu DNS servers, we send a query to the first one. dig +norecurse @E.GTLD-SERVERS.NET any gaia.cs.umass.edu umass.edu. 172800 IN NS ns1.umass.edu. umass.edu. 172800 IN NS ns2.umass.edu. umass.edu. 172800 IN NS ns3.umass.edu. Among all three returned authoritative DNS servers, we send a query to the first one. dig +norecurse @ns1.umass.edu any gaia.cs.umass.edu gaia.cs.umass.edu. 21600 IN A 128.119.245.12 The answer for google.com could be: a.root-servers.net E.GTLD-SERVERS.NET ns1.google.com(authoritative) Problem 20 We can periodically take a snapshot of the DNS caches in the local DNS servers. The Web server that appears most frequently in the DNS caches is the most popular server. This is because if more users are interested in a Web server, then DNS requests for that server are more frequently sent by users. Thus, that Web server will appear in the DNS caches more frequently. For a complete measurement study, see: Craig E. Wills, Mikhail Mikhailov, Hao Shang “Inferring Relative Popularity of Internet Applications by Actively Querying DNS Caches”, in IMC'03, October 27­29, 2003, Miami Beach, Florida, USA Problem 21 Yes, we can use dig to query that Web site in the local DNS server. For example, “dig cnn.com” will return the query time for finding cnn.com. If cnn.com was just accessed a couple of seconds ago, an entry for cnn.com is cached in the local DNS cache, so the query time is 0 msec. Otherwise, the query time is large. Problem 22 For calculating the minimum distribution time for client-server distribution, we use the following formula: Dcs = max {NF/us, F/dmin} Similarly, for calculating the minimum distribution time for P2P distribution, we use the following formula: Where, F = 15 Gbits = 15 * 1024 Mbits us = 30 Mbps dmin = di = 2 Mbps Note, 300Kbps = 300/1024 Mbps. Client Server N 10 100 1000 u 300 Kbps 7680 51200 512000 700 Kbps 7680 51200 512000 2 Mbps 7680 51200 512000 Peer to Peer N 10 100 1000 u 300 Kbps 7680 25904 47559 700 Kbps 7680 15616 21525 2 Mbps 7680 7680 7680 Problem 23 Consider a distribution scheme in which the server sends the file to each client, in parallel, at a rate of a rate of us/N. Note that this rate is less than each of the client’s download rate, since by assumption us/N ≤ dmin. Thus each client can also receive at rate us/N. Since each client receives at rate us/N, the time for each client to receive the entire file is F/( us/N) = NF/ us. Since all the clients receive the file in NF/ us, the overall distribution time is also NF/ us. Consider a distribution scheme in which the server sends the file to each client, in parallel, at a rate of dmin. Note that the aggregate rate, N dmin, is less than the server’s link rate us, since by assumption us/N ≥ dmin. Since each client receives at rate dmin, the time for each client to receive the entire file is F/ dmin. Since all the clients receive the file in this time, the overall distribution time is also F/ dmin. From Section 2.6 we know that DCS ≥ max {NF/us, F/dmin} (Equation 1) Suppose that us/N ≤ dmin. Then from Equation 1 we have DCS ≥ NF/us . But from (a) we have DCS ≤ NF/us . Combining these two gives: DCS = NF/us when us/N ≤ dmin. (Equation 2) We can similarly show that: DCS =F/dmin when us/N ≥ dmin (Equation 3). Combining Equation 2 and Equation 3 gives the desired result. Problem 24 Define u = u1 + u2 + ….. + uN. By assumption us <= (us + u)/N Equation 1 Divide the file into N parts, with the ith part having size (ui/u)F. The server transmits the ith part to peer i at rate ri = (ui/u)us. Note that r1 + r2 + ….. + rN = us, so that the aggregate server rate does not exceed the link rate of the server. Also have each peer i forward the bits it receives to each of the N-1 peers at rate ri. The aggregate forwarding rate by peer i is (N-1)ri. We have (N-1)ri = (N-1)(usui)/u = (us + u)/N Equation 2 Let ri = ui/(N-1) and rN+1 = (us – u/(N-1))/N In this distribution scheme, the file is broken into N+1 parts. The server sends bits from the ith part to the ith peer (i = 1, …., N) at rate ri. Each peer i forwards the bits arriving at rate ri to each of the other N-1 peers. Additionally, the server sends bits from the (N+1) st part at rate rN+1 to each of the N peers. The peers do not forward the bits from the (N+1)st part. The aggregate send rate of the server is r1+ …. + rN + N rN+1 = u/(N-1) + us – u/(N-1) = us Thus, the server’s send rate does not exceed its link rate. The aggregate send rate of peer i is (N-1)ri = ui Thus, each peer’s send rate does not exceed its link rate. In this distribution scheme, peer i receives bits at an aggregate rate of Thus each peer receives the file in NF/(us+u). (For simplicity, we neglected to specify the size of the file part for i = 1, …., N+1. We now provide that here. Let Δ = (us+u)/N be the distribution time. For i = 1, …, N, the ith file part is Fi = ri Δ bits. The (N+1)st file part is FN+1 = rN+1 Δ bits. It is straightforward to show that F1+ ….. + FN+1 = F.) The solution to this part is similar to that of 17 (c). We know from section 2.6 that Combining this with a) and b) gives the desired result. Problem 25 There are N nodes in the overlay network. There are N(N-1)/2 edges. Problem 26 Yes. His first claim is possible, as long as there are enough peers staying in the swarm for a long enough time. Bob can always receive data through optimistic unchoking by other peers. His second claim is also true. He can run a client on each host, let each client “free-ride,” and combine the collected chunks from the different hosts into a single file. He can even write a small scheduling program to make the different hosts ask for different chunks of the file. This is actually a kind of Sybil attack in P2P networks. Problem 27 Peer 3 learns that peer 5 has just left the system, so Peer 3 asks its first successor (Peer 4) for the identifier of its immediate successor (peer 8). Peer 3 will then make peer 8 its second successor. Problem 28 Peer 6 would first send peer 15 a message, saying “what will be peer 6’s predecessor and successor?” This message gets forwarded through the DHT until it reaches peer 5, who realizes that it will be 6’s predecessor and that its current successor, peer 8, will become 6’s successor. Next, peer 5 sends this predecessor and successor information back to 6. Peer 6 can now join the DHT by making peer 8 its successor and by notifying peer 5 that it should change its immediate successor to 6. Problem 29 For each key, we first calculate the distances (using d(k,p)) between itself and all peers, and then store the key in the peer that is closest to the key (that is, with smallest distance value). Problem 30 Yes, randomly assigning keys to peers does not consider the underlying network at all, so it very likely causes mismatches. Such mismatches may degrade the search performance. For example, consider a logical path p1 (consisting of only two logical links): ABC, where A and B are neighboring peers, and B and C are neighboring peers. Suppose that there is another logical path p2 from A to C (consisting of 3 logical links): ADEC. It might be the case that A and B are very far away physically (and separated by many routers), and B and C are very far away physically (and separated by many routers). But it may be the case that A, D, E, and C are all very close physically (and all separated by few routers). In other words, a shorter logical path may correspond to a much longer physical path. Problem 31 If you run TCPClient first, then the client will attempt to make a TCP connection with a non-existent server process. A TCP connection will not be made. UDPClient doesn't establish a TCP connection with the server. Thus, everything should work fine if you first run UDPClient, then run UDPServer, and then type some input into the keyboard. If you use different port numbers, then the client will attempt to establish a TCP connection with the wrong process or a non-existent process. Errors will occur. Problem 32 In the original program, UDPClient does not specify a port number when it creates the socket. In this case, the code lets the underlying operating system choose a port number. With the additional line, when UDPClient is executed, a UDP socket is created with port number 5432 . UDPServer needs to know the client port number so that it can send packets back to the correct client socket. Glancing at UDPServer, we see that the client port number is not “hard-wired” into the server code; instead, UDPServer determines the client port number by unraveling the datagram it receives from the client. Thus UDP server will work with any client port number, including 5432. UDPServer therefore does not need to be modified. Before: Client socket = x (chosen by OS) Server socket = 9876 After: Client socket = 5432 Problem 33 Yes, you can configure many browsers to open multiple simultaneous connections to a Web site. The advantage is that you will you potentially download the file faster. The disadvantage is that you may be hogging the bandwidth, thereby significantly slowing down the downloads of other users who are sharing the same physical links. Problem 34 For an application such as remote login (telnet and ssh), a byte-stream oriented protocol is very natural since there is no notion of message boundaries in the application. When a user types a character, we simply drop the character into the TCP connection. In other applications, we may be sending a series of messages that have inherent boundaries between them. For example, when one SMTP mail server sends another SMTP mail server several email messages back to back. Since TCP does not have a mechanism to indicate the boundaries, the application must add the indications itself, so that receiving side of the application can distinguish one message from the next. If each message were instead put into a distinct UDP segment, the receiving end would be able to distinguish the various messages without any indications added by the sending side of the application. Problem 35 To create a web server, we need to run web server software on a host. Many vendors sell web server software. However, the most popular web server software today is Apache, which is open source and free. Over the years it has been highly optimized by the open-source community. Problem 36 The key is the infohash, the value is an IP address that currently has the file designated by the infohash.   Chapter 3 Review Questions Call this protocol Simple Transport Protocol (STP). At the sender side, STP accepts from the sending process a chunk of data not exceeding 1196 bytes, a destination host address, and a destination port number. STP adds a four-byte header to each chunk and puts the port number of the destination process in this header. STP then gives the destination host address and the resulting segment to the network layer. The network layer delivers the segment to STP at the destination host. STP then examines the port number in the segment, extracts the data from the segment, and passes the data to the process identified by the port number. The segment now has two header fields: a source port field and destination port field. At the sender side, STP accepts a chunk of data not exceeding 1192 bytes, a destination host address, a source port number, and a destination port number. STP creates a segment which contains the application data, source port number, and destination port number. It then gives the segment and the destination host address to the network layer. After receiving the segment, STP at the receiving host gives the application process the application data and the source port number. No, the transport layer does not have to do anything in the core; the transport layer “lives” in the end systems. For sending a letter, the family member is required to give the delegate the letter itself, the address of the destination house, and the name of the recipient. The delegate clearly writes the recipient’s name on the top of the letter. The delegate then puts the letter in an envelope and writes the address of the destination house on the envelope. The delegate then gives the letter to the planet’s mail service. At the receiving side, the delegate receives the letter from the mail service, takes the letter out of the envelope, and takes note of the recipient name written at the top of the letter. The delegate then gives the letter to the family member with this name. No, the mail service does not have to open the envelope; it only examines the address on the envelope. Source port number y and destination port number x. An application developer may not want its application to use TCP’s congestion control, which can throttle the application’s sending rate at times of congestion. Often, designers of IP telephony and IP videoconference applications choose to run their applications over UDP because they want to avoid TCP’s congestion control. Also, some applications do not need the reliable data transfer provided by TCP. Since most firewalls are configured to block UDP traffic, using TCP for video and voice traffic lets the traffic though the firewalls. Yes. The application developer can put reliable data transfer into the application layer protocol. This would require a significant amount of work and debugging, however. Yes, both segments will be directed to the same socket. For each received segment, at the socket interface, the operating system will provide the process with the IP addresses to determine the origins of the individual segments. For each persistent connection, the Web server creates a separate “connection socket”. Each connection socket is identified with a four-tuple: (source IP address, source port number, destination IP address, destination port number). When host C receives and IP datagram, it examines these four fields in the datagram/segment to determine to which socket it should pass the payload of the TCP segment. Thus, the requests from A and B pass through different sockets. The identifier for both of these sockets has 80 for the destination port; however, the identifiers for these sockets have different values for source IP addresses. Unlike UDP, when the transport layer passes a TCP segment’s payload to the application process, it does not specify the source IP address, as this is implicitly specified by the socket identifier. Sequence numbers are required for a receiver to find out whether an arriving packet contains new data or is a retransmission. To handle losses in the channel. If the ACK for a transmitted packet is not received within the duration of the timer for the packet, the packet (or its ACK or NACK) is assumed to have been lost. Hence, the packet is retransmitted. A timer would still be necessary in the protocol rdt 3.0. If the round trip time is known then the only advantage will be that, the sender knows for sure that either the packet or the ACK (or NACK) for the packet has been lost, as compared to the real scenario, where the ACK (or NACK) might still be on the way to the sender, after the timer expires. However, to detect the loss, for each packet, a timer of constant duration will still be necessary at the sender. The packet loss caused a time out after which all the five packets were retransmitted. Loss of an ACK didn’t trigger any retransmission as Go-Back-N uses cumulative acknowledgements. The sender was unable to send sixth packet as the send window size is fixed to 5. When the packet was lost, the received four packets were buffered the receiver. After the timeout, sender retransmitted the lost packet and receiver delivered the buffered packets to application in correct order. Duplicate ACK was sent by the receiver for the lost ACK. The sender was unable to send sixth packet as the send win
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值