Chapter 1 Computer Networks and the Internet
引言
Internet-connected “things”:
laptops, tablets, smartphones → game consoles, surveillance systems, watches, eye glasses, thermostats, cars…
What you will learn ?
—— a broad overview of computer networking and the Internet.
-
Introducing some basic terminology and concepts.
-
Examining the basic hardware and software components.
-
The network’s edge(网络边缘): end systems(端系统) and network applications(网络应用).
-
The core of a computer network(网络核心):
- links(链路) and switches(交换机) —— transport data
- access networks(接入网络) and physical media(物理媒体) —— connect end systems to the network core
-
How these networks connect with each other ?
-
Examine delay(时延), loss(丢包), and throughput(吞吐量) of data.
-
Provide simple quantitative models(定量模型) for end-to-end(端到端的) throughput and delay which takes into transmission(传输时延), propagation(传播时延), and queuing delays(排队时延).
在谢希仁《计算机网络》(第八版,后简称谢书) 中为便于与传播时延进行区分,将传输时延叫做发送时延。
-
Introduce some of the key architectural principles —— protocol layering(协议分层) and service models(服务模型).
-
Computer networks are vulnerable to many different types of attacks.
- Survey some of these attacks.
- How computer networks can be made more secure?
-
A brief history of computer networking.
What Is the Internet(因特网/互联网)?
About the public Internet.
What is the Internet?
—— There are a couple of ways to answer this question:
-
Describe the nuts and bolts of the Internet(基本构成) :
- the basic hardware and software components that make up the Internet.
-
Describe the Internet in terms of a networking infrastructure :
- provides services to distributed applications(分布式应用).
From Wiki: Distributed systems defined as computer systems whose intercommunicating components(互通组件) are located on different networked computers.
谢书中分为互联网的工作原理和应用两方面进行解释。
A Nuts-and-Bolts Description
- The Internet is a computer network that interconnects billions of computing devices throughout the world.
- 谢书:因特网是由数量极大的各种计算机网络互连起来的,覆盖全球,“网络的网络”。
互连网(internet):仅在局部范围内连接起来的网络。
host/end system(主机/端系统)
-
越来越多非传统设备的接入使得 computer network 一词逐渐显得过时,现称这些设备为 host/end system.
-
谢书:网络将许多计算机连接,而互连网将许多网络通过一些路由器连接,与网络相连的计算机称为主机。
谢书中的“网络”即“计算机网络”的简称,而非电信网或有线电视网。
-
End systems are connected together by a network of communication links(通信链路) and packet switches(分组交换机)<网络核心>.
谢书:计算机网络由若干节点(node)和连接这些节点的链路(link)组成。网络中的节点可以是计算机、集线器、交换机、路由器等。Packet Switch 这里指核心工作方式是智能转发的如 Switch和 Router(路由器) 这类设备。在这个高度抽象的模型里,像中继器或调制解调器这样的设备,可以被看作是“通信链路”这个概念的一部分,因为它们的功能是辅助链路本身,而不是进行转发决策。而集线器等设备是早期或特定场景下的技术,它们在如今的网络核心中已经很少见了,在描述现代网络核心功能时常常被忽略。
-
A packet switch takes(接收) a packet(分组/包) arriving on one of its incoming communication links and forwards(转发) that packet on one of its outgoing communication links.
communication links(通信链路)
- Different links can transmit data at different rates, with the transmission rate of a link measured in bits/second(bps) .
- The sending end system segments(分段) the data and adds header bytes(首部/包头 字节) to each segment, then sent these packets(分组/包) through the network to the destination end system, where they are reassembled(组装) into the original data.
- 谢书:通常将要发送的整块数据称为一个报文(message),在发送前先将其划分为一个个等长的数据段,在每个数据段前加一些必要控制信息组成的首部(header)后构成一个分组。分组又称包,分组首部也可称为包头。
packet switches(分组交换机)
Packet switches come in many shapes and flavors, but the two most prominent types in today’s Internet are :
- router(路由器): typically used in access networks
- link-layer switch(链路层交换机): typically used in the network core
route(路由)/path(路径)
The sequence of communication links and packet switches traversed by a packet from the sending end system to the receiving end system is known as a route or path through the network.
一个比喻,传输数据包的分组交换网络在许多方面类似于运输网络,数据包类似于卡车,通信链路类似于高速公路和道路,分组交换机类似于交叉口,而端系统类似于建筑物。正如卡车在运输网络中选择一条路径,数据包也在计算机网络中选择一条路径。
ISP(Internet Service Provider, 互联网服务 提供者/提供商)
例如中国电信、移动等都是有名的 ISP 。
-
Each ISP is in itself(本身) a network of packet switches and communication links.
- ISPs provide a variety of types of network access to the end systems.
- ISPs also provide Internet access to content providers, connecting servers directly to the Internet.
为终端用户提供的网络接入就像你家里的自来水管,你作为终端用户,主要目的是从互联网这个巨大的“水库”中获取信息(下载),偶尔上传的数据量远小于你下载的数据量。连接需经过ISP的多个本地和区域性网络层级,才能汇入互联网的核心骨干网。
为内容提供商提供网络接入就像自来水厂或大型数据中心的总出水管,它们的数据流向主要是“上传”——将数据从服务器上传到互联网,再由用户下载。连接点通常就在ISP的骨干网节点上,或者直接位于互联网交换中心(IXP),跳过了大量的中间汇聚层。
-
Lower-tier ISPs are interconnected through national and international upper-tier ISPs.
Upper-tier ISPs are connected directly to each other. -
Whether upper-tier or lower-tier, is managed independently, runs the IP protocol, and conforms to certain naming and address conventions.
protocal(协议)
- End systems, packet switches, and other pieces of the Internet run protocols that control the sending and receiving of information within the Internet.
- 谢书:网络协议(network protocol)是为进行网络中的数据交换而建立的规则、标准或约定,它明确规定了所交换数据的格式及有关的同步问题。主要由语法、语义、同步三要素组成。
Transmission Control Protocol (TCP) and Internet Protocol (IP)
- The IP protocol specifies the format of the packets that are sent and received among routers and end systems.
- The Internet’s principal protocols are collectively known as TCP/IP.
Internet standard
- Internet standards are developed by the Internet Engineering Task Force (IETF) .
- 谢书:制定互联网的正式标准要经过以下三个阶段:
(1)互联网草案(Internet Draft)——互联网草案的有效期只有六个月。在这个阶段还不能算是RFC文档。
(2)建议标准(Proposed Standard)——从这个阶段开始就成为RFC文档。
(3)互联网标准(Internet Standard)——如果经过长期的检验,证明某个建议标准可以成为互联网标准时,就给它分配一个标准编号,记为 STDxx(有时也写成 4 位数字,如 STD0005)。
RFC(requests for comment)
- The IETF standards documents are called requests for comments (RFCs).
- 谢书:一个互联网标准可以和多个 RFC 文档关联。
A Services Description
distributed application(分布式应用)
-
Distributed applications involve multiple end systems that exchange data with each other.
-
Internet applications run on end systems (they do not run in the packet switches in the network core).
-
Although packet switches facilitate(促进) the exchange of data among end systems, they are not concerned with the application that is the source or sink(源头或去向) of data.
这就是分组交换机的工作方式。 一个路由器(最典型的分组交换机)收到一个数据包时只关心数据包的包头,特别是目标 IP 地址,它根据这个地址查询自己的路由表,然后将数据包从正确的端口转发出去。
If you are developing a distributed Internet application, the programs running on the different end systems will need to send data to each other. And here we get to a central issue—one that leads to the alternative way of describing the Internet as a platform for applications. How does one program running on one end system instruct the Internet to deliver data to another program running on another end system?
socket interface(套接字接口)
-
End systems attached to the Internet provide a socket interface that specifies how a program running on one end system asks the Internet infrastructure to deliver data to a specific destination program running on another end system.
这里与 IP 协议进行区分,IP 协议是一套规则,它定义了机器与机器之间如何寻址和路由数据包,解决的是主机到主机的通信;而套接字接口是一个应用程序编程接口(API),是操作系统提供给程序员的一个工具(Tool),用于实现程序与程序之间的通信。
对比前面的 packet switches ,socket interface 的根本目的就是 concerned with the application that is the source or sink(源头或去向) of data.
-
This Internet socket interface is a set of rules that the sending program must follow so that the Internet can deliver the data to the destination program.
一个比喻,A想通过邮政服务给B寄一封信,邮政服务要求A将信放入信封中;在信封的中央写上B的全名、地址和邮政编码等一系列流程。因此,邮政服务有其自己的“邮政服务接口”或一套规则,A必须遵循这些规则才能是此次通信成功。类似地,互联网也有一个套接字接口,发送数据的程序必须遵循该接口,以便互联网能够将数据传递给接收数据的程序。
当然你可以想到,就像邮政服务当然为客户提供的不止一种服务,互联网也为其应用提供了多种服务。当您开发互联网应用时,您也必须为您的应用选择一种互联网服务。
What Is a Protocol?
A Human Analogy
一个比喻,就像人际交往中不同的动作(含发送和接收这些信息时采取的一系列常规动作)代表不同的含义,这些内容就是协议本身。
- Networking also takes two (or more) communicating entities running the same protocol in order to accomplish a task.
Network Protocols
-
The entities exchanging messages and taking actions are hardware or software components of some device.
一个例子,想象一下当你向网页服务器发送请求时会发生什么?图1.2的右半部分进行了说明。首先,你的计算机会向网页服务器发送一个连接请求消息,并等待回复,网页服务器接收到你的连接请求消息后返回一个连接回复消息,在得到请求网页文档后的允许后,你的计算机会在一个GET消息中发送它想从该网页服务器获取的网页名称,最后,网页服务器将网页(事实上,谢书:网页就是在客户程序窗口上显示的文档。)返回给你的计算机。
-
A protocol defines the format and the order of messages exchanged between two or more communicating entities, as well as the actions taken on the transmission and/or receipt of a message or other event.
例如,两个物理连接的计算机之间的硬件实现协议控制着在两块网络接口卡之间“电缆”上传输的比特流;端系统中的拥塞控制协议则控制着数据包在发送方和接收方之间传输的速率;路由器中的协议决定了数据包从源头到目的地的路径等等。
The Network Edge
- 谢书:网络边缘由所有连接在互联网上的主机组成。这部分是用户直接使用的,用来进行通信(传送数据、音频、视频)和资源共享。
We begin at the edge of the network and look at the components with which we are most familiar —— namely, the computers, smartphones and other devices that we use on a daily basis.
- Why are devices connected to the Internet referred to as end systems?
—— Because they sit at the edge of the Internet.
-
End systems are also referred to as hosts because they host/run(承载/运行) application programs.
-
Hosts are sometimes further divided into two categories: clients(客户端) and servers(服务器).
The servers tend to be more powerful machines that store and distribute Web pages, stream video(流式传输视频), relay(转发) e-mail, and so on.
Today, most of the servers from which we receive search results, e-mail, Web pages, videos and mobile app content reside in large data centers. -
计算机之间的通信:主机 A 的某个进程与主机 B 上的另一个进程进行通信。
-
网络边缘的端系统间的通信方式可划分为两大类:
- 客户/服务器方式(C/S 方式):客户是服务请求方,服务器是提供方。
- 对等(P2P 方式)
Access Networks
- access network: the network that physically connects an end system to the first router (also known as the “edge router(边缘路由器)” on a path from the end system to any other distant end system.
Home Access: DSL, Cable, FTTH, and 5G Fixed Wireless
Today, the two most prevalent types of broadband residential access are digital subscriber line (DSL, 数字用户线) and cable(有线电视).
DSL
一个家庭通常通过提供有线电话接入的 the same local telephone company (telco, 电信公司) 获得 DSL 互联网接入。因此,当使用 DSL 时,客户的电信公司也是其互联网服务提供商(ISP)。
如图1.5所示,每个客户的 DSL modem 利用 the existing telephone line 与位于 CO(电信公司本地中心局) 的 DSL 接入 DSLAM (数字用户线接入复用器) 进行数据交换。
家庭的 DSL modem 将数字数据转换为 high- frequency tones ,通过 telephone wires 传输到 CO ;来自许多这样的住宅的模拟信号在 DSLAM 处被转换回数字格式。
家庭的 telephone line 同时承载 data and traditional telephone signals ,这些信号在不同频率下编码:
Channel Type | Frequency Range |
---|---|
High-Speed Downstream | 50 kHz - 1 MHz |
Medium-Speed Upstream | 4 kHz - 50 kHz |
Ordinary Two-Way Telephone | 0 - 4 kHz |
这种方法使得 the single DSL link 看起来像是 three separate links ,从而允许 a telephone call 和 an Internet connection 同时共享 the DSL link 。
同一时间内,在客户端,a splitter(分离器) 将到达家庭的 data and traditional telephone signals <频率不同> 分开,并转发到 DSL modem ;在telco的一侧(即在 CO 处) ,由 DSLAM 负责分离,并将 data 发送到互联网。
- Hundreds or even thousands of households connect to a single DSLAM.
- Because the downstream(下行) and upstream(上行) rates are different, the access is said to be asymmetric(非对称接入).
- The maximum rate is also limited by the distance between the home and the CO, the gauge(规格) of the twisted-pair line(双绞线) and the degree of electrical interference.
Engineers have expressly designed DSL for short distances between the home and the CO; generally, if the residence is not located within 5 to 10 miles of the CO, the residence must resort to an alternative form of Internet access.
Cable
While DSL makes use of the telco’s existing local telephone infrastructure, cable Internet access(有线互联网接入) makes use of the cable television company(有线电视公司)’s existing cable television infrastructure.
- A residence obtains cable Internet access from the same company that provides its cable television.
Fiber optics(光纤) connect the cable head(有线电视中心) end to neighborhood-level junctions(社区级接入点), from which traditional coaxial cable(同轴电缆) is then used to reach individual houses and apartments.
Each neighborhood junction typically supports 500 to 5,000 homes.
-
Because both fiber and coaxial cable are employed in this system, it is often referred to as hybrid fiber coax (HFC,混合光纤同轴).
-
Cable internet access requires cable modems(有线调制解调器), as with a DSL modem, the cable modem is typically an external device(外部设备) and connects to the home PC through an Ethernet port(以太网端口).
-
The cable modem termination system (CMTS,有线调制解调器终端系统) serves a similar function as the DSL network’s DSLAM —— turning the analog signal(模拟信号) sent from the cable modems in many downstream homes back into digital format.
需要理清的是,这句话描述的是一个 上行(upstream) 过程:想象你在发送邮件,邮件数据会以数字形式从你的电脑通过以太网线传给 Cable Modem ,Cable Modem 会将你的数字数据调制成一个特定上行频率的模拟信号,通过同轴电缆发送。当然,由于是共享介质,Cable Modem需要使用一种类似"对讲机"的机制(如DOCSIS协议规定),先“听”一下线路是否空闲,然后才能“说话”,以避免和邻居的上传数据冲突。CMTS 接收从千家万户的 Cable Modem(包括你)发送过来的模拟信号,并将其转换回数字格式,通过高速光纤主干道送入互联网。
针对一个 下行(downstream) 过程,则应该是:想象你在浏览视频,视频数据将以数字形式(0和1)通过高速光纤主干道,从互联网服务器到达你所在社区的有线电视中心,进入 CMTS,CMTS 会将这些数字数据调制成特定频率的模拟信号,当然,CMTS 同时也会把传统的电视节目信号混合到这条线路中。这个混合了数据和电视节目的模拟信号,通过同轴电缆这个共享介质,广播给整个社区的所有家庭。你家的 Cable Modem 将接收到的模拟信号解调,只接收分配给你的那个特定数据频率频道,而忽略邻居的数据和电视信号,并将其转换回你的电脑能理解的数字信号 ,最后通过以太网线将这些数字信号送给你的路由器或电脑。
-
Cable modems divide the HFC network into two channels(频道), a downstream and an upstream channel, and as with DSL, access is typically asymmetric, with the downstream channel typically allocated a higher transmission rate than the upstream channel.
DOCSIS 2.0和3.0标准分别定义了下行比特率为40 Mbps和1.2 Gbps,上行速率为30 Mbps和100 Mbps。
-
But as in the case of DSL networks, the maximum achievable rate may not be realized due to lower contracted data rates(低合约速率) or media impairments(媒介损伤).
简单引入一下,任何通信信道(这里所指的连接的特定 HFC 网络节点上所有用户共享的总带宽池)的最高信息传输速率都不是无限的,比较著名的是香农公式: 。
而“合约速率”是运营商给你设定的上限,你的速度绝不会超过你所购买的套餐速率;“媒介损伤”是现实环境下的“真实体质”,它会直接拉低香农定理中的信噪比(),从而降低实际可达到的最大速率。
FTTH(光纤到户)
- The FTTH(fiber to the home) concept is simple—provide an optical fiber path from the CO directly to the home, is an up-and-coming technology that provides even higher speeds(FTTH can potentially provide Internet access rates in the gigabits(千兆比特) per second range).
速度对比说明:这里的单位是 Mbps (Megabits per second,兆比特每秒) 和 Gbps (Gigabits per second,千兆比特每秒)。
1 Gbps = 1,000 Mbps
技术类型 | 典型下载速度范围 | 典型上传速度范围 | 关键限制因素 |
---|---|---|---|
DSL | 10 - 100 Mbps | 1 - 20 Mbps | 距离、线路老化、电磁干扰 |
Cable | 50 Mbps - 1 Gbps | 10 - 50 Mbps | 邻居共享带宽、上行速率受限 |
FTTH | 1 Gbps - 10 Gbps | 1 Gbps - 10 Gbps (对称) | 技术成本、设备处理能力 |
假设我们要下载一个大小为 50 GB (Gigabytes) 的文件。(注意:1 Byte = 8 bits)
-
在 20 Mbps 的 DSL 网络上:
- 50 GB * 8 / 20 Mbps = 20,000 秒 ≈ 5.5 小时
- 你需要在睡觉前开始下载,第二天早上才能玩上。
-
在 200 Mbps 的 Cable 网络上:
- 50 GB * 8 / 200 Mbps = 2,000 秒 ≈ 33 分钟
- 一杯咖啡的时间,尚可接受。
-
在 1 Gbps (1000 Mbps) 的 FTTH 网络上:
- 50 GB * 8 / 1000 Mbps = 400 秒 ≈ 6.7 分钟
- 下载变成了去泡杯茶、上个厕所就能完成的事情。几乎是“即时”的体验。
- There are several competing technologies for optical distribution(光纤分配技术) :
- The simplest optical distribution network is called direct fiber, with one fiber leaving the CO for each home.
- More commonly, each fiber leaving the central office is actually shared by many homes; it is not until the fiber gets relatively close to the homes that it is split into individual customer-specific fibers.
- two competing optical-distribution network architectures to perform this split:
- active optical networks (AONs, 主动光网络) : AON is essentially switched Ethernet.
- assive optical networks (PONs, 被动光网络)
- PON is used in Verizon’s FiOS service.
- Each home connect a home router (typically a wireless router) to an optical network terminator (ONT,光网络终端), which(通常少于100个家庭) is connected by dedicated optical fiber(专用光纤) to a neighborhood splitter(社区分离器) which connects to an optical line terminator (OLT,光线路终端) in the telco’s CO.
- The OLT, providing conversion between optical and electrical signals(光信号和电信号), connects to the Internet via a telco router.
- In the PON architecture, all packets sent from OLT to the splitter are replicated(复制) at the splitter (similar to a cable head end).
- two competing optical-distribution network architectures to perform this split:
5G Fixed Wireless
- 5G fixed wireless not only promises high-speed residential access, but will do so without installing costly and failure-prone cabling from the telco’s CO to the home.
- With 5G fixed wireless, using beam-forming(波束成性) technology, data is sent wirelessly from a provider’s base station to the a modem in the home.
- A WiFi wireless router is connected to the modem (possibly bundled together), similar to how a WiFi wireless router is connected to a cable or DSL modem.
Access in the Enterprise (and the Home): Ethernet and WiFi
Ethernet
- A local area network (LAN, 局域网) is used to connect an end system to the edge router.
- Ethernet(以太网) is by far the most prevalent(普遍的) access technology in corporate, university, and home networks.
- Ethernet users use twisted-pair copper wire(双绞铜线) to connect to an Ethernet switch(以太交换机).
- With Ethernet access, users typically have 100 Mbps to tens of Gbps access to the Ethernet switch, whereas servers may have 1 Gbps 10 Gbps access.
WiFi
-
In a wireless LAN setting, wireless users transmit/receive packets to/from an access point that is connected into the enterprise’s network (most likely using wired Ethernet), which in turn is connected to the wired Internet.
-
A wireless LAN user must typically be within a few tens of meters of the access point.
-
Wireless LAN(无线局域网) access based on IEEE 802.11 technology, more colloquially known as WiFi.
-
Many homes combine broadband residential access (that is, cable modems or DSL) with these inexpensive wireless LAN technologies to create powerful home networks Figure 1.9 shows a typical home network.
-
The wireless access point(无线接入点) as a base station which communicates with the wireless PC and other wireless devices in the home ,and through a home router to the Internet.
Wide-Area Wireless Access: 3G and LTE 4G and 5G
- These devices employ the same wireless infrastructure used for cellular telephony(蜂窝电话技术) to send/receive packets through a base station that is operated by the cellular network(蜂窝网络) provider.
- Unlike WiFi, a user need only be within a few tens of kilometers of the base station(基站).
- 4G技术提供现实世界中高达 60 Mbps 的下载速度,更高速的广域接入技术——第五代(5G)无线网络也已经开始部署。
Physical Media
—— a brief overview of transmission media(传输媒体) that are commonly used in the Internet.
recall:
- HFC uses a combination of fiber cable and coaxial cable.
- DSL and Ethernet use copper wire.
- Mobile access networks use the radio spectrum(无线电频谱).
此部分在谢书《2.3 物理层下面的传输媒体》中被详细介绍,它将数据传输系统中在发送器和接收器之间的物理通路称为传输媒介/传输介质,并将其分为导引型传输媒介和非导引型传输媒介,二者的区别在于电磁波在两种媒介上的的传播方式不同。前者固定、有形,就像一条专属的“管道”或“轨道”,提供了提供了大容量、高可靠的骨干网络;后者则相反,它灵活性极高,使用户可以自由移动,随时随地接入网络。
- 谢书:在导引型传输媒介中,电磁波被导引沿着固定媒介(铜线或光纤)的传播;而非导引型传输媒介就是指自由空间,在非导引型传输媒介中电磁波的传播称为无线传输。
一个例子引入,下面展示一个 bit 在端到端的传输。
graph LR
subgraph "End-to-End Path"
A[💻 End System A] -- "<b>Link 1(physical medium 1)</b><br/>电磁波/光脉冲形式传输" --> R1[📡Router 1]
R1 -- "<b>Link 2(physical medium 2)</b><br/>电磁波/光脉冲形式传输" --> R2[📡 Router 2]
R2 -- "<b>Link 3(physical medium 3)</b><br/>电磁波/光脉冲形式传输" --> Rn[···]
Rn[···] -- "<b>Link n(physical medium n)</b><br/>电磁波/光脉冲形式传输" --> B[💻 End System B]
end
style A fill:#cde4ff,stroke:#333,stroke-width:1px
style B fill:#cde4ff,stroke:#333,stroke-width:1px
style R1 fill:#ffefc1,stroke:#333,stroke-width:1px
style R2 fill:#ffefc1,stroke:#333,stroke-width:1px
style Rn fill:#ffefc1,stroke:#333,stroke-width:1px
- The physical medium can take many shapes and forms and does not have to be of the same type for each transmitter-receiver pair along the path.
- Physical media fall into two categories:
- guided media(导向媒介)
- The waves(波动) are guided along a solid medium, such as a fiber-optic cable, a twisted-pair copper wire, or a coaxial cable(光纤、双绞铜线或同轴电缆).
- unguided media(非导向媒介)
- The waves propagate in the atmosphere and in outer space, such as in a wireless LAN or a digital satellite channel(无线局域网或数字卫星频道).
- guided media(导向媒介)
costs(成本)
- The physical link (copper wire and fiber-optic cable, 铜线和光纤电缆) is often relatively minor.
- In particular, the labor cost associated with the installation of the physical link can be orders of magnitude higher than the cost of the material.
人工成本的昂贵使得许多建筑商在建筑的每个房间中都安装双绞线、光纤和同轴电缆,以避免将来使用另一种媒介铺设额外线路的费用。
guided media
Twisted-Pair Copper Wire
- the least expensive and most commonly used guided transmission medium
- Twisted pair consists of two insulated(绝缘的) copper wires, each about 1 mm thick, arranged in a regular spiral pattern(螺旋形).
- The wires are twisted together to reduce the electrical interference(电干扰) from similar pairs close by.
- Typically, a number of pairs are bundled together in a cable by wrapping the pairs in a protective shield, and a wire pair constitutes a single communication link.
- Unshielded twisted pair (UTP, 无屏蔽双绞线) is commonly used for computer networks within a building, that is, for LANs.
- Data rates for LANs using twisted pair today range from 10 Mbps to 10 Gbps, and the data rates that can be achieved depend on the thickness of the wire and the distance between transmitter and receiver.
Coaxial Cable
-
Coaxial cable consists of two copper conductors(铜导体), but the two conductors are concentric(同心) rather than parallel.
-
Coaxial cable is quite common in cable television systems which been coupled with cable modems to provide residential users with Internet access at rates of hundreds of Mbps.
-
Coaxial cable can be used as a guided shared medium(共享介质).
结合前文有线互联网接入的实现理解,多个终端系统可以直接连接到电缆上,每个终端系统都可以接收其他终端系统发送的内容。
Fiber Optics
- An optical fiber is a thin, flexible medium that conducts(传导) pulses of light(光脉冲), with each pulse representing a bit.
- A single optical fiber can support tremendous bit rates, up to tens or even hundreds of gigabits per second.
- They are immune(免疫) to electromagnetic interference, have very low signal attenuation(信号衰减) up to 100 kilometers, and are very hard to tap(被窃取).
- Fiber optics is the preferred long-haul(长距离) guided transmission media, particularly for overseas links.
unguided media
Radio channels carry signals in the electromagnetic spectrum(电磁频谱), they require no physical wire to be installed, can penetrate walls(穿墙), provide connectivity to a mobile user, and can potentially carry a signal for long distances.
无线电频道的特性在很大程度上取决于 propagation environment(传播环境) 以及信号传输的距离。
环境因素决定了 path loss(路径损耗) 和 shadow fading(阴影衰减)(这些因素会降低信号强度,因为信号在距离和绕过/穿透障碍物的过程中会减弱)、multipath fading(多径衰落)(由于信号反射到干扰物体上)以及干扰(由于其他传输和电磁信号)。
Terrestrial Radio Channels(地面无线电频道)
- operate over very short distance
- operate in local areas
- operate in the wide area
个人设备如无线耳机、键盘和医疗设备通常在短距离内工作;前面描述的无线局域网技术使用局部无线电频道;而蜂窝接入技术则使用广域无线电频道。
Satellite Radio Channels(卫星无线电频道)
- ground stations(地面站): two or more Earth-based microwave transmitter/receivers linked by a communication satellite.
- The satellite receives transmissions on one frequency band(频率带), regenerates(再生) the signal using a repeater(转发器), and transmits the signal on another frequency.
-
geostationary satellites(静止卫星)
静止卫星始终位于地球上方的同一位置,将卫星置于地球表面 36,000 公里的轨道上,可以实现这种静止状态。
卫星与地面站之间的巨大距离引入了显著的信号传播延迟,通常为 280ms 。然而,无线卫星链路可以在数百 Mbps 的速度下工作,常用于没有 DSL 或有线互联网接入的地区。 -
low-earth orbiting (LEO) satellites(低地球轨道卫星)
LEO卫星则更靠近地球,并且不保持在同一位置,它们围绕地球旋转(就像月球一样),并可以相互通信,以及与地面站进行通信。为了提供连续的覆盖,许多卫星需要被放置在轨道上。
The Network Core
The network core —— the mesh(网络结构) of packet switches and links that interconnects the Internet’s end systems.
Packet Switching(分组交换)
- In a network application, end systems exchange messages with each other.
- To send a message from a source end system to a destination end system, the source breaks long messages into smaller chunks of data(数据块) known as packets.
- Between source and destination, each packet travels through communication links and packet switches (for which there are two predominant types, routers and link-layer switches).
- Packets are transmitted over each communication link at a rate equal to the full transmission rate of the link.
比如,source end system or a packet switch 在传输速率为 R bits/sec 的链路上发送一个 L bits 的 packet,则传输该 packet 所需的时间为 L/R seconds 。
Store-and-Forward Transmission(存储-转发传输)
- Most packet switches use store-and-forward transmission at the inputs to the links.
- Store-and-forward transmission means that the packet switch must receive the entire packet before it can begin to transmit the first bit of the packet onto the outbound link(出站链路).
- A router will typically have many incident links(入站链路), since its job is to switch an incoming packet onto an outgoing link; in this simple example, the router has the rather simple task of transferring a packet from one (input) link to the only other attached link.
在图 1.11 所示的时间快照(the snapshot of time)中,源系统已传输数据包 1 的部分内容,而数据包 1 的前面部分已经到达路由器。由于路由器采用存储转发机制,在此时,路由器无法传输已接收的比特;相反,它必须首先缓冲(即“存储”)数据包的比特。只有在路由器接收到所有数据包的比特后,它才能开始传输(即“转发”)数据包到出站链路。
计算:(忽略传播时延 —— 信号通过电缆传播所需的时间)
(1)源系统在时间 0 开始传输,经过 L/R 秒,源系统已传输并存储了整个数据包 1,同时路由器处也接收并存储了整个数据包 1 。
(2)在 L/R 秒时,路由器开始将数据包发送到指向目标的出站链路;
(3)在 2L/R 秒时,路由器已传输整个数据包,目标也已接收到该数据包。
因此,传输一个数据包的总延迟为 2L/R 秒。
对比一下,如果交换机如果能够在接收到比特后立即转发(而不必先接收整个数据包 1),那么总延迟将为 L/R 秒。
思考:发送/传输 三个数据包的时延是多少?
—— 4L/R 秒
若发送一个数据包,路径由 N 条速率为 R 的链路组成(因此在源和目标之间有 N-1 个路由器),得出端到端延迟为:
思考:发送/传输 P 个数据包的时延是多少?
Queuing Delays(排队时延) and Packet Loss(丢包)
- Each packet switch has multiple links attached to it, and for each attached link, the packet switch has an output buffer/output queue(输出缓冲区/输出队列), which stores packets that the router is about to send into that link.
- If an arriving packet needs to be transmitted onto a link but finds the link busy with the transmission of another packet, the arriving packet must wait in the output buffer.
- Queuing delays are variable and depend on the level of congestion in the network.
- Since the amount of buffer space is finite(有限), sometimes packet loss will occur —— either the arriving packet or one of the already-queued packets will be dropped.
图 1.12 是一个简单的数据包交换网络。数据包用三维块表示,块的宽度表示数据包中的比特数。此图中,所有数据包的宽度相同,因此长度也相同。假设主机 A 和 B 正在向主机 E 发送数据包,它们首先通过 100 Mbps 以太网链路将其数据包发送到第一个路由器,然后由路由器将这些数据包引导到 15 Mbps 的链路。
短时间内如果到达路由器的数据包速率(转换为比特每秒)超过 15 Mbps,路由器的输出缓冲区将会出现拥塞,因为数据包在被传输到链路之前需要排队。
Forwarding Tables(转发表) and Routing Protocols(路由协议)
How does the router determine which link it should forward the packet onto?
About how it is done in the Internet.
-
Every end system has an address called an IP address.
-
When a source end system wants to send a packet to a destination end system, the source includes the destination’s IP address in the packet’s header.
-
Each router has a forwarding table that maps destination addresses (or portions of the destination addresses) to that router’s outbound links.
一个比喻,端到端的路由像一个不使用地图,只询问方向的司机。它告知被询问人终点而仅获取路线的中较近的一个地址,到达后再询问下一个人,周而复始。
How do forwarding tables get set? Are they configured by hand in each and every router, or does the Internet use a more automated procedure?
互联网有多种特殊的路由协议(Routing Protocols),这些协议用于自动配置转发表。路由协议可以例如确定从每个路由器到每个目标的最短路径,并将结果配置到路由器中的转发表中。
Circuit Switching(电路交换)
-
In circuit-switched networks, the resources needed along a path (buffers, link transmission rate) to provide for communication between the end systems are reserved for the duration of the communication session between the end systems.Unlike package switching.
一个比喻,电路交换是需要预定的餐厅而分组交换不需要。对于需要预订的餐厅,我们必须在离开之前打电话进行预订。但是,当我们到达不需要预订的餐厅时,原则上我们可以立即入座并点餐。而对于不需要预订的餐厅,我们则不需要费心去预订桌子。然而,当我们到达餐厅时,可能需要等候一段时间才能入座。
这实质是分组交换无连接性的体现,电路交换需要首先建立连接,连接成功后沿途的每一个交换机(路由器)都会为这次通信预留专用的资源;而分组交换源主机可以立即开始发送数据包,不需要等待网络确认,但没有预留任何链路资源很可能会导致延迟,因此互联网尽力及时传递数据包,但并不提供任何保证。
-
电路交换的一个典例是传统电话网络。
发送信息前网络必须在发送者和接收者之间建立连接,交换机在发送者和接收者之间的路径上维护该连接的状态。这个连接被称为电路,当网络建立电路时,它还会在网络的链路上保留一个恒定的传输速率(表示每条链路传输能力的一部分),以供连接持续使用。由于在连接期间为该发送者与接收者的连接保留了特定的传输速率,发送者可以以保证的恒定速率将数据传输给接收者。
图 1.13 是一个电路交换网络,4个 circuit switches 通过4条链路相互连接,每条链路有4个电路。
当主机 A 要与主机 B 想要通信时,网络首先需要在每条链路上保留一个电路,来建立一个专用的主机到主机的端到端连接(本例中为第2条链路的第1个电路和第2条链路的第4个电路)。
由于每条链路都有四个电路,通过端到端连接获得的连接在连接期间使用链路的总传输能力的一部分。
例如,如果每条相邻交换机之间的链路传输速率为 1 Mbps,那么每个电路交换连接将获得 250 kbps 的专用传输速率。
Multiplexing(多路复用) in Circuit-Switched Networks
- FDM(frequency-division multiplexing, 频分多路复用)
- The frequency spectrum(频谱) of a link is divided up among the connections established across the link.
- TDM(time-division multiplexing, 时分多路复用)
- Time is divided into frames of fixed duration, and each frame is divided into a fixed number of time slots.
图1.14展示了FDM和TDM在支持最多四个电路的特定网络链路中的应用。对于FDM,频率域被划分为四个带宽为4 kHz的频带。对于TDM,时间域被划分为固定时长的帧,每帧中有四个时间片;每个电路在旋转的TDM帧中被分配相同的专用时间片。对于TDM,电路的传输速率等于帧率乘以每个时间片中的位数。例如,如果链路每秒传输8000帧,每个时间片由8位组成,那么每个电路的传输速率为64 kbps。
数据包交换的支持者始终认为,电路交换在“静默期”时是浪费的,因为专用电路在此期间处于闲置状态;此外,建立端到端电路和保留端到端传输容量是复杂的,并且需要复杂的信令软件来协调沿着端到端路径的交换机操作。
思考:假设我们要将一个640,000位的文件从主机 A 发送到主机 B ,经过一个电路交换网络。假设网络中的所有链路都使用时分多路复用(TDM),每个链路有 24 个时间片,并且比特率为 1.536 Mbps。同时,假设在主机 A 开始传输文件之前,建立端到端电路需要 500ms 。发送这个文件需要多长时间?
—— 10.5s
Packet Switching Versus Circuit Switching
A Network of Networks
Delay, Loss, and Throughput in Packet-Switched Networks
Computer networks necessarily constrain(限制) throughput (the amount of data per second that can be transferred) between end systems, introduce delays between end systems, and can actually lose packets.
Overview of Delay in Packet-Switched Networks
- A packet can be transmitted on a link only if there is no other packet currently being transmitted on the link and if there are no other packets preceding it in the queue.
- If the link is currently busy or if there are other packets already queued for the link, the newly arriving packet will then join the queue.
Types of Delay
Processing Delay
- The time required to examine the packet’s header and determine where to direct the packet is part of the processing delay.
- Processing delays in high-speed routers are typically on the order of microseconds or less.
Queuing Delay
- At the queue, the packet experiences a queuing delay as it waits to be transmitted onto the link.
- Queuing delays can be on the order of microseconds to milliseconds(毫秒) in practice.
Transmission Delay
- The transmission delay is the amount of time required to push (that is, transmit) all of the packet’s bits into the link.
- The propagation speed depends on the physical medium of the link (that is, fiber optics, twisted-pair copper wire, and so on) and is in the range of meters/sec to meters/sec.
- Transmission delays are typically on the order of microseconds to milliseconds in practice.
Propagation Delay
- The time required to propagate from the beginning of the link to router B is the propagation delay.
- In wide-area networks(广域网), propagation delays are on the order of milliseconds.
Comparing Transmission and Propagation Delay
- The transmission delay 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 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.
区分一点,这里 transmission rate of the link 指的是路由器将 packet “推上”链路的速率而非在两个路由器之间链路的传播速率;原文省略了后者,做出一个隐含的假设:我们讨论的网络链路,其物理介质是确定的,因此传播速率是一个固定的常量。实际上传播时延还与物理介质传播速率有关。
Queuing Delay and Packet Loss
- When characterizing(描述) queuing delay, one typically uses statistical measures(统计测量), such as average queuing delay, variance(方差) of queuing delay, and the probability that the queuing delay exceeds some specified value.
When is the queuing delay large and when is it insignificant?
—— depends on the rate at which traffic arrives at the queue, the transmission rate of the link, and the nature of the arriving traffic, that is, whether the traffic arrives periodically(周期性) or arrives in bursts(突发方式).
- 设 表示到达队列的数据包的平均速率(packets/sec), 是链路的传输速率(bits/sec);为简化计算,假设所有数据包都由 位组成,则数据包到达队列的平均速率为 bits/sec;最后假设队列非常大,可以容纳几乎无限数量的比特。
- 流量强度 通常在估算排队延迟的范围内起着重要作用。若 > 1,那么到达队列的数据包速率将超过可以从队列中传输比特的速率,队列将倾向于无限增长,排队延迟将接近无穷大!因此,交通工程中的一条黄金法则是:设计你的系统,使流量强度不大于1。
- 现考虑 > 1 的情况,此时流量的性质影响排队延迟。
- 若数据包周期性到达(即每 秒到达一个数据包),则每个数据包将以空队列的方式到达——此时不会有排队延迟。
- 若数据包以突发方式到达,将会有显著的平均排队延迟。例如,假设 个数据包在 秒内同时到达。第一个数据包不会有排队延迟;第二个被传输的数据包将有排队延迟。
Typically, the arrival process to a queue is random; that is, the arrivals do not follow any pattern and the packets are spaced apart by random amounts of time.
- 流量强度接近 0 时,数据包到达频率较低,几乎没有到达的数据包与队列中的其他数据包相遇,平均排队延迟将接近 0 。
- 流量强度接近 1 时,存在一些时间间隔,间隔内到达速率超过传输能力将形成队列;当到达速率低于传输能力时,队列长度将缩短。 但不管怎样平均队列长度将越来越大。
- 一个重要方面是,流量强度接近 1 时,平均排队延迟会迅速增加,即便是微小的流量强度百分比增加也将导致排队延迟大幅增加。
Packet Loss
- A queue preceding a link has finite capacity.
- Because the queue capacity is finite, packet delays do not really approach infinity as the traffic intensity(流量强度) approaches 1.
- Why? —— With no place to store such a packet, a router will drop that packet; that is, the packet will be lost.
- From an end-system viewpoint, a packet loss will look like a packet having been transmitted into the network core but never emerging from the network at the destination.
Therefore, performance at a node is often measured not only in terms of delay, but also in terms of the probability of packet loss(丢包率).
End-to-End Delay
假设网络未拥塞(排队时延忽略不计),源主机的传输速率为 bits/sec,数据包大小为 ;源主机和目标主机间有 个路由器,每个路由器传输时延与源主机相等,为 ,处理时延为 ;每条链路的传播时延为 。
节点延迟的累积将形成端到端延迟:
书里这个公式应该还假设了源主机也存在与路由器相当的处理时延,此外,实际上,分组交换具备“流水线”效应,应该是:
当然,实际上,上述公式都是极为理想化的状态,书中提示我们可以更多思考“ eterogeneous delays(异构时延)”和“average queuing delay(平均排队时延)”情况下公式的推广,此时“流水线”效应难以考虑,我们将在原方程基础上推广。
- 适应异构性
- 考虑平均排队时延
Traceroute
- When the user specifies(指定) a destination hostname, the program in the source host sends multiple, special packets through a series of routers, and routers sends back to the source a short message that contains the name and address of the router.
- The source records the time that elapses between when it sends a packet, when it receives the corresponding return message and the name and address of the router (or the destination host) that returns the message.
- Traceroute actually repeats the experiment just described three times.
以下是 Traceroute 的输出示例,其中的路径是从源主机 gaia.cs.umass.edu(马萨诸塞大学)到计算机科学系在巴黎索邦大学的主机(以前该大学被称为 UPMC)。
输出包含六列:第一列是上述提到的 值,即沿着路由的路由器编号;第二列是路由器的名称;第三列是路由器的地址(形式为 xxx.xxx.xxx.xxx);最后三列是三次实验的往返延迟。
如果源主机从任何给定路由器接收到的数据包少于三条(由于网络中的数据包丢失),Traceroute 会在路由器编号后面加上一个星号,以表示该路由器的往返延迟次数少于三次。
1 | 1 gw-vlan-2451.cs.umass.edu (128.119.245.1) 1.899 ms 3.266 ms 3.280 ms |
在上述追踪中,有 14 个路由器在源和目的地之间,其中大多数路由器都有名称,并且都有地址。
例如,路由器 4 的名称是 corel-rt-et-5-2-0.gw.umass.edu,其地址是 128.119.0.9。
查看该路由器的三次实验数据,我们发现第一次实验的源与路由器之间的往返延迟为 0.351 毫秒,后两次实验的往返延迟分别为 0.392 毫秒和 0.380 毫秒。
这些往返延迟包括了之前讨论的所有延迟,包括传输延迟、传播延迟、路由器处理延迟和排队延迟。
由于排队延迟随时间变化,发送给路由器 n 的数据包的往返延迟有时会长于发送给路由器 n+1 的数据包的往返延迟。
上述示例中也可以观察到这一现象:路由器 12 的延迟小于路由器 11 的延迟!同时注意从路由器 7 到路由器 8 的往返延迟的大幅增加。这是因为路由器 7 和 8 之间存在一条跨大西洋的光纤链路,导致了相对较大的传播延迟。
End System, Application, and Other Delays
Throughput in Computer Networks
- Consider transferring a large file from Host A to Host B across a computer network, the instantaneous throughput at any instant of time is the rate (in bits/sec) at which Host B is receiving the file.
设 表示服务器和路由器之间链路的速率, 表示路由器和客户端之间链路的速率。
假设在整个网络中仅有从服务器发送到客户端的比特,在这种理想场景下,服务器到客户端的吞吐量是多少?
将比特视为流体,并将通信链路视为管道。显然服务器无法以超过 bps 的速率通过其链路泵送比特;而路由器也无法以超过 bps 的速率转发比特。
这个 two-link network 吞吐量为 ,即 bottleneck link(瓶颈链路) 的传输速率。
注意, 情况下若比特继续以 的速率到达路由器,并以 的速率离开路由器,那么路由器中等待传输到客户端的比特积压将会不断增加 —— NO!
确定吞吐量后,可近似计算从服务器到客户端传输一个大文件所需的时间,公式为:
图 1.20(b) 存在 10 个同时进行的下载,涉及 10 对客户端和服务器。
假设这 10 个下载是当前网络中唯一的流量,设 为此链路的传输速率,所有服务器链路的速率都与 相同,而所有客户端接入链路的速率都与 相同,且核心中所有链路的传输速率都远超 和 。
如果核心链路的速率与 和 相同,这些下载的吞吐量是多少?
假设 Mbps, Mbps, Mbps,而共同链路将其传输速率平均分配给 10 个下载。那么每个下载的吞吐量将减小到 500 kbps。
- Throughput depends on the transmission rates of the links over which the data flows.<干扰流量>