计算机网络自顶向下方法之一一一第一章 之二

1.3.2 Circuit Switching

有两种基本方法在网络的链路和交换机中传递数据: circuit switching(电路交换)和packet switching(分组交换) ,前边小节已经讲了packet switched networks ,这节我们将学习circuit-switched networks 。

电路交换 : 整个报文的比特流连续地从源点直达终点 ,好像在一个管道中传送
分组交换 : 单个分组(这只是整个报文的一部分)传送到相邻节点 ,存储下来后查找转发表 , 转发到下一个结点 。

一个类比 ,想象两个餐厅 ,一个需要预约 ,而另一个不需要, 对于这个需要预约的餐厅来说 ,我们得有电话预约的麻烦 ,但是原则上讲 ,当我们到了的时候可以立刻入座并点餐 ,对于这个不需要预约的餐厅来讲 ,我们不用烦恼预约的问题 ,但是当我们到了那里的时候 ,我们可能得等待有空座的时候才能入座 。

传统电话网络就是电路交换的例子 ,当我们想用电话网络传送消息的时候 ,在发送方可以发送之前 ,这个网络必须要在发送方和接收方之间建立一个连接 ,在电话界术语中 ,这个连接叫做circuit , 当建立连接之后 ,网络还会在这个通话期间在网络链路中为这个通话保留一个固定的传输速率 ,因为网络会为这个连接保留固定的传输速率 ,所以发送方可以以所保障的固定速率来进行传输 。


上图就是一个电路交换网络 ,四个circuit 交换机相互连接 ,他们之间各有四条连线 ,这每条连线中有四个circuit ,所以每条连线可以同时支持4个对话 (由此 ,每个会话的传输速率是总的这条link速率的四分之一),hosts都直接连在交换机上 ,当两个主机想要通信 ,网络会生成一个专用的端对端连接 。

Multiplexing in Circuit-Switched Networks
link中的circuit会有时分复用(TDM)或者频分复用 (FDM) ,
FDM中 ,link中的频率范围可以被分成link中的circuit的数量 。link会为每一个会话在通话期间分配专用的频带, 总的连接宽度叫做带宽 。

对于TDM, 时间被分成定长的很多frames ,然后每一个frame会被分成固定数量的time slots ,当网络要生成一个连接时 ,网络会从每个frame中取一个time slot ,这些time slots只给这个连接使用

对于时分复用 ,传输速率等于frame rate乘每个slot中的比特数 。
For example, if the link transmits 8,000 frames per second and each slot consists of 8 bits, then the transmission rate of a circuit is 64 kbps.

我们来做个数学题 ,想想看电路交换时分复用法发送一个640,000 bits的文件从A到B需要多长时间 ,假设每条link的frame都有24 slots ,每条link传输速率为1,536 Mbps 。再假设生成一个端对端连接需要500 ms ,由上可知 ,每个circuit传输速率为 1536 Mbps /24 kbps = 64 kbps ,则总的传输时间为640000 bits/64 kbps = 10s , 加上开始时500ms ,总的时间就是10.5s ,重点说明传输时间是独立于link的数量的 ,不管要经过一条还是一百条link ,时间都会是10s ,(然而实际情况会有propagation delay,即传输延迟 )

Packet Switching Versus Circuit Switching

1.3.3 A Network of Networks

网络把许多计算机连接在一起 ,而因特网把许多网络连接在一起 。

Network Structure 4 : To build a network that more closely resembles today’s Internet, we must add points of presence (PoPs), multi-homing, peering, and Internet exchange points (IXPs) to the hierarchical Network Structure 3.

Network Structure 5 builds on top of Network Structure 4 by adding content provider networks

By creating its own network, a content provider not only
reduces its payments to upper-tier ISPs, but also has greater control of how its services are ultimately delivered to end users.

1.4 Delay , Loss , and Throughput in Packet-Switched Networks

我们都希望互联网服务能够如我们所想,无拘无束的传送大量数据 ,并且不会丢失 ,但是这在现实中是不可能的 ,而且 ,互联网必须要控制吞吐量(也就是每秒能够传输的数据总量 ),会产生延迟 ,而且也会丢失数据 。

1.4.1 Overview of Delay in Packet-Switched Networks

数据包从发送到被接收在链路中的结点处都会经历好几种类型的延迟 ,其中最重要的延迟包括 :nodal processing delay , queuing delay , transmission delay , propagation delay 。这些延迟总的产生一个total nodal delay 。

Types of Delay
Processing Delay

查看数据包的header和决定把包发送到哪里的时间是processing delay的一部分 ,processing delay还可以包括检查数据包中bit-level错误的时间 ,在高速路由中processing delay一般在ms级甚至更少 ,这个延迟之后路由器把包输出到通往下一个目的地的链路中 。

Queuing Delay

在队列中 ,包等待被发送到链路中的时间便是queuing delay ,如果队列是空的 ,当时没有别的包被传输 ,那么我们的queuing delay便是0 ,反过来讲 ,如果当时有很多包等待传输 ,则queuing delay就会很长 ,这种延迟大约在毫秒级到微妙级 。

Transmission Delay

假设数据是用先来先服务的方法传送的 ,像所有的packet-switched网络一样 ,数据包得等到所有数据到达之后才可以再发送 ,假设包长度为L bits ,传输速率为R bits/sec ,举个例之 ,对于一个10 Mbps的以太连接 ,速率是R=10Mbps ,对于100 Mbps的连接 ,速率是100 Mbps ,transmission delay为L/R,这就是要把这个包发送到链路中所需的总时间 ,这种延迟一般在微妙到毫秒级 。

Propagation Delay

当一个比特进入到链路中的时候 ,它就需要被传输到目的地 ,从进入链路开始到下一个目的地所用的时间就是propagation delay ,propagation speed取决于链路的物理材料 ,大约在一个光速或者2/3个光速之间 ,propagation delay就是链路的长度除以传输的速率(propagation speed) ,这种延迟大约在毫秒级 。

Comparing Transmission and Propagation Delay

两者的不同很微小但却很重要 ,The transmission delay is the amount of time required for the router to push out the packet; it is a function of the packet’s length and the transmission rate of the link, but has nothing to do with the distance between the two routers. The propagation delay, on the other hand, is the time it takes a bit to propagate from one router to the next; it is a function of the distance between the two routers, but has nothing to do with the packet’s length or the transmission rate of the link.

1.4.2 Queuing Delay and Packet Loss

结点延迟中最复杂最有意思的要数queuing delay ,和其他三种延迟不同的是 ,queuing delay可以因包而异 ,举个栗子 ,10个包到了一个空队列 ,第一个包等待的时间将是0 ,然而最后一个包要等前九个传输完才能开始传输 ,所以当描述queuing delay的时候 ,我们通常用统计学的方法 ,比如average queuing delay ,variance(方差) of queuing delay ,还有queuing delay超过某些给定值的概率 。
Design your system so that the traffic intensity is no greater than 1.
假设每个包L bits ,包到达路由器的速率是a ,路由器的传输速率是R ,则traffic intensity = aL/R .

当La/R ≤ 1时 ,the nature of the arriving traffic impacts the queuing delay 。举个栗子 ,如果每隔L/R来一个包的话 ,那么每个包到达的时候都是一个空队列 ,但是如果包爆炸性到来的时候 ,就会产生很显著的queuing delay .

上边的假设是很理想化的 ,现实中包都是随机到达的 ,这种情况下 ,La/R就不能充分的说明queuing delay的特点了 ,

Packet Loss

在上边的讨论中 ,我们假设队列可以处理无穷多的包 ,然而实际上它的能力是有限的 ,由此即使traffic intensity接近1的时候packet delay也不会是无穷大 ,取而代之的是 ,当一个包到达的时候队列已满 ,路由器便会抛弃这个包 ,因此包便会丢失 .

因此 ,一个点的性能不只是看延迟 ,还会看包丢失的可能性 。

1.4.3 End-to-End Delay

我们上边的研究都是专注于nodal delay ,就是在一个路由器处的延迟 ,现在我们要看一下从源头到目的地总的延迟 。

Traceroute

Traceroute is a simple program that can run in any Internet host. When the user specifies a destination hostname, the program in the source host sends multiple, special packets toward that destination. As these packets work their way toward the destination, they pass through a series of routers. When a router receives one of these special packets, it sends back to the source a short message that contains the name and address of the router.

End System ,Application , and Other Delays

除了上边我们讲到的延迟 ,end systems中还有另外的显著的延迟 ,比如 ,终端系统想要发送一个包到共享界质(比如WiFi),也许会“有意延迟”作为它协议的一部分 ,另一个很重要的延迟是media packetization delay ,存在于 voice-over-IP(VoIP)中,在VoIP中 ,发送方在发送之前必须要先要把包装满加密的数字化的讲话片段 ,装满一个包的时间 ,叫做packetization delay ,会很明显并且影响到用户体验 。

1.4.4 Thoughput in Computer Networks

除了延迟和包丢失 ,计算机网络中另一个重要的性能标准是端对端吞吐量 ,为了定义吞吐量 ,假设要从A主机发到B主机一个大文件 ,举个栗子 ,一个大的视频片段在P2P文件分享系统中从一个peer发送到另一个 ,瞬时吞吐量在任何一个时刻都等于主机B接收速率,如果B用了Ts接受了F bits ,那么平均吞吐量就是F/T bits/sec 。


对于上图中的a来讲 ,吞吐量为两个传输速率中的小者 。对于b来说自然也是 。


通过这两个图我们看到如果线路中没有其他的数据传输的话 ,吞吐量大约就是从源头到终点这一路上的最小传输速率 ,

1.5 Protocol Layers and Their Service Models

1.5.1 Layered Architecture

You purchase your ticket, check your bags, go to the gate, and eventually get loaded onto the plane. The plane takes off and is routed to its destination. After your plane lands, you deplane at the gate and claim your bags. If the trip was bad, you complain about the flight to the ticket agent (getting nothing for your effort). This scenario is shown in Figure 1.21.


Each layer provides its service by (1) performing certain actions within that layer (for example, at the gate layer, loading and unloading people from an airplane) and by (2) using the services of the layer directly below it (for example, in the gate layer, using the runway-torunway passenger transfer service of the takeoff/landing layer).
For large and complex systems that are constantly being updated, the ability to change the implementation of a service without affecting other components of the system is another important advantage of layering.

Protocol Layering

每个协议隶属于一个层次 ,就像飞行中的每个步骤一样 ,我们要再看一看每一层提供给上一层的服务 ,所谓一个层次的服务模型 ,每个层次提供服务通过(1)在本层内进行实际的行为 (2)利用下面的一层提供的功能 .

A protocol layer can be implemented in software, in hardware, or in a combination of the two.Application-layer protocols—such as HTTP and SMTP—are almostalways implemented in software in the end systems; so are transport-layer protocols. Because the physical layer and data link layers are responsible for handling communication over a specific link, they are typically implemented in a network interface card (for example, Ethernet or WiFi interface cards) associated with a given link. The network layer is often a mixed implementation of hardware and software. Also note that just as the functions in the layered airline architecture were distributed among the various airports and flight control centers that make up the system, so too is a layer n protocol distributed among the end systems, packet switches, and other components that make up the network. That is, there’s often a piece of a layer n protocol in each of these network components.

各个层次的协议们放在一起叫做protocol stack ,Internet protocol stack包含五个层次 ,如图 。

Application Layer

应用层就是网络应用以及应用层协议存在的地方 ,此层包含许多协议 ,比如HTTP (which provides for Web document request and transfer ), SMTP(which provides for the transfer of email messages),FTP(which provides for the transfer of files between two end systems ) . 我们将看见把人类友好的域名变成32位的IP地址也是在特定的应用层协议帮助下完成的 ,叫做 DNS(domain name system) ,

应用层协议分布在多种终端系统中 ,一个终端系统中的应用利用协议与另一个终端系统上的应用交换数据包 ,我们把应用层的包叫做message

Transport Layer

传输层在应用端之间传输应用层messages ,互联网中有两个传输层协议 ,TCP和UDP ,他们都可以传输应用层messages ,TCP向应用提供面向连接的服务 ,此服务保证传输到达 ,有流量控制 ,它也会把长的messages分割成短的segments而且提供阻塞控制机制 ,所以发送源在网络阻塞时会减小它的发送速率 。UDP协议提供一种不提供不必要服务的服务 ,没有流量控制 ,没有传输保证 ,没有阻塞控制 ,我们把传输层的包叫做segment

Network Layer

网络层对网络层数据包的主机间传输是有责任的 ,网路层的包叫做datagrams ,发送方的传输层协议会向网络层传输一个传输层segment和一个目的地地址 , 然后网络层便会提供把segment传输到目标主机的服务 。

网络层协议中包含著名的IP协议 ,它定义了这里的datagram和终端系统与路由器如何在这里运行 ,互联网中所有有网络层的部件必须运行IP协议 ,这一层还包括routing protocols ,它们决定datagram将会经过哪些路由器从发送端到目的地 ,虽然这一层即包含了IP协议,也包含许多routing 协议 ,但是我们通常把这一层叫做IP layer ,反映出一个事实—IP是连接整个互联网的粘合剂 。

网络层使datagram经过一系列的路由器到达终点 ,把数据包从线路中的一个点运送到另一个点 ,网络层需要仰赖连接层的服务 。特别的 ,在每个结点处 ,网络层把datagram传输到连接层 ,在连接层datagram被发送到线路中的下一个结点 ,在这个结点 ,连接层又会把datagram传输到网络层 。

连接层所提供的服务依赖于配置与链路上的特定的连接层协议 ,举个栗子 ,有的连接层洗衣提供reliable delivery,从一个结点经过链路到下一个结点 ,重点说明这个可靠地传输和TCP的可靠传输是不一样的 ,TCP是在两个终端系统之间提供可靠传输服务 ,

连接层的协议有 Ethernet ,WiFi ,还有the cable access network’s DOCSIS protocol , 因为datagram从源头到目的地通常要经过过个链路 ,所以这个过程中可能它会被不同的协议操控 。我们把连接层的包叫做frames

Physical Layer

连接层的作用是把整个frames从一个网络部件运送到相邻的网络部件 ,物理层的作用就是把frames中的每个bit从一个结点运送到另一个结点 ,这一层的协议将依赖于传输媒介(比如双绞线 ,光纤), 举个栗子 ,以太网有很多不同的物理层协议 :一个适用双绞线的 ,另一些适用同轴电缆的, 还有些适用光纤的,等等 。每种情况下 ,比特都是以不同的方式通过链路的 。

The OSI Model

ISO(International Organization for Standardization) 在1970年代曾提出网络分为七个层次 ,叫做Open System Interconnection (OSI)model ,

多出的两个层次是 presentation layer 和session layer ,presentation layer的作用是提供允许应用解释所交换信息的意思的服务 ,包括数据压缩和数据加密以及数据解密 。The session layer provides for delimiting(划定界限)and synchronization (同步性)of data exchange, including the means to build a checkpointing(检查点) and recovery(复原) scheme.(方案)。

1.5.2 Encapsulation


Similar to end systems, routers and link-layer switches organize their networking hardware and software into layers 。但是路由器和链路层交换机并不执行协议栈中的所有层次 ,链路层交换机执行1,2层 ,路由器执行1到3层 ,这意味着 ,举个栗子 ,路由器有能力执行IP协议 ,但是链路层交换机不行 ,一会儿我们将会看到虽然链路层交换机不能识别IP地址 ,但他们能识别layer 2的地址,比如Ethernet address ,重点说明主机执行所有五个层次 ,这和互联网架构把尽量多的它的复杂部分放在网络的边缘的观点是一致的 。

图还阐明了封装的重要概念 ,在发送方 ,应用层message被传输到传输层 ,最简单的情况 ,传输层接收message并加上接收方传输层要用到的信息 ,然后应用层message和传输层header一起组成传输层segment ,传输层segment因此封装了应用层message ,加上的部分可能包括允许接收方传输层把message传输到正确的应用的信息 ,或者error-detection bits 允许接收方发现那个bit在路上改变了 ,传输层之后把segment传输给网络层 ,在网络层加上网络层header生成网络层datagram ,这header中包括源头和目的地终端系统地址 ,然后datagram被传输到连接层 ,然后加上连接层的header生成连接层frame ,因此,我们看到在每一层中 ,数据包都有两个部分 :header field 和 payload field ,负重就是上一层的包 。

实际中的封装步骤要更复杂。

1.6 Networks Under Attack

The bad guys can put malware(恶意软件) into your host via the Internet

我们易感染的主机或许与许多同样易感染的设备连接在一起构成一个网络 ,这便叫做botnet ,即僵尸网络 。which bad guys control and leverage for spam email distribution and distributed denial-of-service attacks against targeted host .
大多数恶意软件可以自我复制 ,当它感染一台计算机 ,它会通过互联网从这台计算机寻找达到另一台计算机的入口 ,然后以此类推 ,它可以以很快的速度传播 。
Viruses are malware that require some form of user interaction to infect the user’s device 。Worms are malware that can enter a device without any explicit user interaction.

The bad guys can attack servers and network infrastructure
另外一种安全威胁是DoS(denial-of-service) ,DoS攻击大体分为下面三种 :

漏洞攻击(vulnerability attack): 这种方法是发送一些巧妙的信息到易感染的应用或者目标计算机上运行的系统 ,然后真正合法的消息再发送到这里的时候 ,应用或系统会停止服务 ,更严重的时候 ,主机可能崩溃 。
Bandwidth flooding : 攻击者向目标主机发送大量的数据包 ,足够多的包使目标主机的链路阻塞 ,导致合法的包会不能到达计算机 。
Connection flooding :攻击者与攻击目标建立大量半开放或全开放的TCP连接 ,然后目标主机便会拒绝合法的连接 。

让我们深入的看一下Bandwidth flooding ,如果服务器接收速率为R bps ,则攻击者需要大约R bps的速率才能造成破坏 ,如果这个R很大的话 ,一个单独的攻击点恐怕是不能发出如此大的流量对服务器造成攻击 ,还有就是如果所有流量都从一个点发出 ,上传路由也许可以发现这次攻击 ,并且会截断这些流量 。由此产生了DDoS(distributed DoS)攻击 ,下图显示 ,攻击者控制多个发送源并让每个源都向目标攻击 。

The bad guys can sniff packets
A passive receiver that records a copy of every packet that flies by is called a packet sniffer.

The bad guys can masquerade as someone you trust
用任意的地址来发送数据包惊人的容易 ,用假地址向互联网中注射数据包的能力叫做IP spoofing,是众多伪装的一种 。
解决此问题 ,我们需要进行end-point authentication ,

1.7 History of Computer Networking and the Internet

1.8 Summary

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值