Data Communication Computer Network 简明教程

Computer Network Quick Guide

Data Communication Overview

将计算机与打印机等计算机化外围设备互连的系统称为计算机网络。计算机间的这种互连促进了它们之间的信息共享。计算机可以通过有线或无线媒体互相连接。

A system of interconnected computers and computerized peripherals such as printers is called computer network. This interconnection among computers facilitates information sharing among them. Computers may connect to each other by either wired or wireless media.

Classification of Computer Networks

计算机网络基于各种因素进行分类,包括:

Computer networks are classified based on various factors.They includes:

  1. Geographical span

  2. Inter-connectivity

  3. Administration

  4. Architecture

Geographical Span

从地理位置来看,网络可以归入以下类别之一:

Geographically a network can be seen in one of the following categories:

  1. It may be spanned across your table, among Bluetooth enabled devices,. Ranging not more than few meters.

  2. It may be spanned across a whole building, including intermediate devices to connect all floors.

  3. It may be spanned across a whole city.

  4. It may be spanned across multiple cities or provinces.

  5. It may be one network covering whole world.

Inter-Connectivity

网络的组件可以通过不同的方式相互连接。连通性是指逻辑上、物理上或两者兼而有之的连接。

Components of a network can be connected to each other differently in some fashion. By connectedness we mean either logically , physically , or both ways.

  1. Every single device can be connected to every other device on network, making the network mesh.

  2. All devices can be connected to a single medium but geographically disconnected, created bus like structure.

  3. Each device is connected to its left and right peers only, creating linear structure.

  4. All devices connected together with a single device, creating star like structure.

  5. All devices connected arbitrarily using all previous ways to connect each other, resulting in a hybrid structure.

Administration

从管理员的角度来看,网络可以是属于单个自治系统的私有网络,并且无法在其物理或逻辑域外部进行访问。网络可以是所有人都可以访问的公共网络。

From an administrator’s point of view, a network can be private network which belongs a single autonomous system and cannot be accessed outside its physical or logical domain.A network can be public which is accessed by all.

Network Architecture

  1. There can be one or more systems acting as Server. Other being Client, requests the Server to serve requests.Server takes and processes request on behalf of Clients.

  2. Two systems can be connected Point-to-Point, or in back-to-back fashion. They both reside at the same level and called peers.

  3. There can be hybrid network which involves network architecture of both the above types.

Network Applications

计算机系统和外围设备连接起来形成网络。它们提供了许多优点:

Computer systems and peripherals are connected to form a network.They provide numerous advantages:

  1. Resource sharing such as printers and storage devices

  2. Exchange of information by means of e-Mails and FTP

  3. Information sharing by using Web or Internet

  4. Interaction with other users using dynamic web pages

  5. IP phones

  6. Video conferences

  7. Parallel computing

  8. Instant messaging

Computer Network Types

通常, 网络根据它们的地理跨度进行区分。网络可以小到你的手机与其蓝牙耳机之间的距离, 也可以大到互联网本身, 覆盖整个地理世界。

Generally, networks are distinguished based on their geographical span. A network can be as small as distance between your mobile phone and its Bluetooth headphone and as large as the internet itself, covering the whole geographical world,

Personal Area Network

个人局域网络(PAN)是最小的网络, 对用户来说非常私密。这可能包括启用蓝牙的设备或启用红外的设备。PAN 的连接范围高达 10 米。PAN 可能包括无线电脑键盘和鼠标, 蓝牙耳机, 无线打印机和电视遥控器。

A Personal Area Network (PAN) is smallest network which is very personal to a user. This may include Bluetooth enabled devices or infra-red enabled devices. PAN has connectivity range up to 10 meters. PAN may include wireless computer keyboard and mouse, Bluetooth enabled headphones, wireless printers and TV remotes.

Bluetooth

例如, 小网是启用蓝牙的个人局域网络, 可能最多包含 8 个设备以主从方式连接在一起。

For example, Piconet is Bluetooth-enabled Personal Area Network which may contain up to 8 devices connected together in a master-slave fashion.

Local Area Network

在建筑物内跨越并由单个管理系统操作的计算机网络通常称为局域网(LAN)。通常, LAN 涵盖了组织的办公室、学校、大学。连接到 LAN 中的系统数量可以从至少两个到多达 1600 万个。

A computer network spanned inside a building and operated under single administrative system is generally termed as Local Area Network (LAN). Usually,LAN covers an organization’ offices, schools, colleges or universities. Number of systems connected in LAN may vary from as least as two to as much as 16 million.

LAN 提供了一种在终端用户之间共享资源的有用方法。诸如打印机、文件服务器、扫描仪和互联网之类的资源可以在计算机之间轻松共享。

LAN provides a useful way of sharing the resources between end users.The resources such as printers, file servers, scanners, and internet are easily sharable among computers.

LAN

LAN 由廉价的网络和路由设备组成。它可能包含服务文件存储和本地共享的其他应用程序的本地服务器。它主要在私有 IP 地址上运行, 并且不涉及繁重的路由。LAN 在其自己的本地域内工作, 由中心控制。

LANs are composed of inexpensive networking and routing equipment. It may contains local servers serving file storage and other locally shared applications. It mostly operates on private IP addresses and does not involve heavy routing. LAN works under its own local domain and controlled centrally.

LAN 使用以太网或令牌环技术。以太网是最广泛采用的 LAN 技术并使用星形拓扑, 而令牌环很少见。

LAN uses either Ethernet or Token-ring technology. Ethernet is most widely employed LAN technology and uses Star topology, while Token-ring is rarely seen.

LAN 可以是以太网, 无线或同时采用这两种形式。

LAN can be wired,wireless, or in both forms at once.

Metropolitan Area Network

城域网络(MAN)通常像有线电视网络一样扩展到整个城市。它可以是以太网、令牌环、ATM 或光纤分布式数据接口(FDDI)的形式。

The Metropolitan Area Network (MAN) generally expands throughout a city such as cable TV network. It can be in the form of Ethernet,Token-ring, ATM, or Fiber Distributed Data Interface (FDDI).

Metro Ethernet 是一项由 ISP 提供的服务。此服务使其用户能够扩展其局域网。例如, MAN 可以帮助组织连接城市中所有办事处。

Metro Ethernet is a service which is provided by ISPs. This service enables its users to expand their Local Area Networks. For example, MAN can help an organization to connect all of its offices in a city.

MAN

MAN 的骨干是高容量、高速光纤。MAN 在局域网和广域网之间工作。MAN 提供了 LAN 到 WAN 或互联网的上行链路。

Backbone of MAN is high-capacity and high-speed fiber optics. MAN works in between Local Area Network and Wide Area Network. MAN provides uplink for LANs to WANs or internet.

Wide Area Network

顾名思义, 广域网(WAN)覆盖了一个可能跨越多个省甚至一个整个国家的广阔区域。一般来说, 电信网络是广域网。这些网络提供与 MAN 和 LAN 的连接。由于它们配备了超高速骨干网, WAN 使用非常昂贵的网络设备。

As the name suggests,the Wide Area Network (WAN) covers a wide area which may span across provinces and even a whole country. Generally, telecommunication networks are Wide Area Network. These networks provide connectivity to MANs and LANs. Since they are equipped with very high speed backbone, WANs use very expensive network equipment.

WAN

WAN 可以使用诸如异步传输模式(ATM)、帧中继和同步光网络(SONET)等先进技术。WAN 可能由多个管理人员管理。

WAN may use advanced technologies such as Asynchronous Transfer Mode (ATM), Frame Relay, and Synchronous Optical Network (SONET). WAN may be managed by multiple administration.

Internetwork

网络的网络称为互联网络或简单地称为互联网。它是这个星球上存在的最大的网络。互联网广泛连接所有 WAN, 并可以连接到 LAN 和家庭网络。互联网使用 TCP/IP 协议套件, 并使用 IP 作为其寻址协议。现如今, 互联网广泛使用 IPv4 实现。由于地址空间短缺, 它正逐渐从 IPv4 迁移到 IPv6。

A network of networks is called an internetwork, or simply the internet. It is the largest network in existence on this planet.The internet hugely connects all WANs and it can have connection to LANs and Home networks. Internet uses TCP/IP protocol suite and uses IP as its addressing protocol. Present day, Internet is widely implemented using IPv4. Because of shortage of address spaces, it is gradually migrating from IPv4 to IPv6.

互联网使用户可以共享和访问全球范围内的海量信息。它使用万维网、FTP、电子邮件服务、音频和视频流等。在巨大的层面上,互联网使用客户端-服务端模型。

Internet enables its users to share and access enormous amount of information worldwide. It uses WWW, FTP, email services, audio and video streaming etc. At huge level, internet works on Client-Server model.

互联网采用速度极高的光纤骨干网。为了连接各种洲,将光纤铺设在海中,我们称之为海底通信电缆。

Internet uses very high speed backbone of fiber optics. To inter-connect various continents, fibers are laid under sea known to us as submarine communication cable.

互联网广泛部署在使用 HTML 链接页面的万维网服务上,并可以通过客户端软件(即 Web 浏览器)访问。当用户使用位于世界任何地方某个 Web 服务器上的 Web 浏览器请求页面时,Web 服务器将使用适当的 HTML 页面进行响应。通信延迟非常低。

Internet is widely deployed on World Wide Web services using HTML linked pages and is accessible by client software known as Web Browsers. When a user requests a page using some web browser located on some Web Server anywhere in the world, the Web Server responds with the proper HTML page. The communication delay is very low.

互联网提供了多重用途,涉足我们生活的各个方面。其中包括:

Internet is serving many proposes and is involved in many aspects of life. Some of them are:

  1. Web sites

  2. E-mail

  3. Instant Messaging

  4. Blogging

  5. Social Media

  6. Marketing

  7. Networking

  8. Resource Sharing

  9. Audio and Video Streaming

Network LAN Technologies

让我们简要了解一下各种局域网 (LAN) 技术:

Let us go through various LAN technologies in brief:

Ethernet

以太网是一种广泛部署的局域网技术,该技术由鲍勃·梅特卡夫和 D.R. 博格斯于 1970 年发明。它于 1980 年在 IEEE 802.3 中标准化。

Ethernet is a widely deployed LAN technology.This technology was invented by Bob Metcalfe and D.R. Boggs in the year 1970. It was standardized in IEEE 802.3 in 1980.

以太网共享介质。使用共享介质的网络数据很容易发生冲突。以太网使用载波侦听多路访问/冲突检测 (CSMA/CD) 技术来检测冲突。当在以太网中发生冲突时,所有主机都会回滚,等待一段时间,然后重新传输数据。

Ethernet shares media. Network which uses shared media has high probability of data collision. Ethernet uses Carrier Sense Multi Access/Collision Detection (CSMA/CD) technology to detect collisions. On the occurrence of collision in Ethernet, all its hosts roll back, wait for some random amount of time, and then re-transmit the data.

以太网连接器是具有 48 位 MAC 地址的网络接口卡。这有助于其他以太网设备识别以太网中的远程设备并与其通信。

Ethernet connector is,network interface card equipped with 48-bits MAC address. This helps other Ethernet devices to identify and communicate with remote devices in Ethernet.

传统的以太网使用 10BASE-T 规范。数字 10 表示 10Mbps 的速度,BASE 表示基带,而 T 表示粗以太网。10BASE-T 以太网提供高达 10Mbps 的传输速度,并使用同轴电缆或带有 RJ-45 连接器的 Cat-5 双绞线同轴电缆。以太网采用星形拓扑结构,线段长度最长为 100 米。所有设备都以星形方式连接到集线器/交换机。

Traditional Ethernet uses 10BASE-T specifications.The number 10 depicts 10MBPS speed, BASE stands for baseband, and T stands for Thick Ethernet. 10BASE-T Ethernet provides transmission speed up to 10MBPS and uses coaxial cable or Cat-5 twisted pair cable with RJ-45 connector. Ethernet follows star topology with segment length up to 100 meters. All devices are connected to a hub/switch in a star fashion.

Fast-Ethernet

为了满足快速发展的软件和硬件技术的需要,以太网扩展为快速以太网。它可以在 UTP、光纤和无线环境下运行。它可以提供高达 100 Mbps 的速度。此标准在 IEEE 803.2 中使用 Cat-5 双绞线电缆命名为 100BASE-T。对于有线介质,它使用 CSMA/CD 技术在以太网主机之间共享,而对于无线以太网局域网,它使用 CSMA/CA(CA 表示冲突避免)技术。

To encompass need of fast emerging software and hardware technologies, Ethernet extends itself as Fast-Ethernet. It can run on UTP, Optical Fiber, and wirelessly too. It can provide speed up to 100 MBPS. This standard is named as 100BASE-T in IEEE 803.2 using Cat-5 twisted pair cable. It uses CSMA/CD technique for wired media sharing among the Ethernet hosts and CSMA/CA (CA stands for Collision Avoidance) technique for wireless Ethernet LAN.

光纤上的快速以太网在 100BASE-FX 标准下定义,该标准提供高达 100 Mbps 的光纤速度。光纤上的以太网在半双工模式下可以扩展到 100 米,在多模光纤上的全双工模式下可以达到 2000 米。

Fast Ethernet on fiber is defined under 100BASE-FX standard which provides speed up to 100 MBPS on fiber. Ethernet over fiber can be extended up to 100 meters in half-duplex mode and can reach maximum of 2000 meters in full-duplex over multimode fibers.

Giga-Ethernet

快速以太网在 1995 年推出后,仅享受了 3 年的高速状态,直到千兆以太网的推出。千兆以太网提供高达 1000 兆位/秒的速度。IEEE802.3ab 使用 Cat-5、Cat-5e 和 Cat-6 电缆对千兆以太网进行了标准化。IEEE802.3ah 定义了光纤上的千兆以太网。

After being introduced in 1995, Fast-Ethernet could enjoy its high speed status only for 3 years till Giga-Ethernet introduced. Giga-Ethernet provides speed up to 1000 mbits/seconds. IEEE802.3ab standardize Giga-Ethernet over UTP using Cat-5, Cat-5e and Cat-6 cables. IEEE802.3ah defines Giga-Ethernet over Fiber.

Virtual LAN

局域网使用以太网,而以太网又使用共享介质。以太网中的共享介质会创建一个单一广播域和一个单一冲突域。将交换机引入以太网已经消除了单一冲突域问题,并且连接到交换机的每个设备都在其单独的冲突域中工作。但即使交换机也不能将网络划分为单独的广播域。

LAN uses Ethernet which in turn works on shared media. Shared media in Ethernet create one single Broadcast domain and one single Collision domain. Introduction of switches to Ethernet has removed single collision domain issue and each device connected to switch works in its separate collision domain. But even Switches cannot divide a network into separate Broadcast domains.

虚拟局域网 (VLAN) 是将单个广播域划分为多个广播域的解决方案。一个 VLAN 中的主机无法与另一个 VLAN 中的主机通信。默认情况下,所有主机都被置于同一 VLAN 中。

Virtual LAN is a solution to divide a single Broadcast domain into multiple Broadcast domains. Host in one VLAN cannot speak to a host in another. By default, all hosts are placed into the same VLAN.

VLAN

在此图中,不同的 VLAN 以不同的颜色代码表示。同一 VLAN 中的主机即使连接到同一交换机上也无法看到或与不同 VLAN 中的其他主机通信。VLAN 是一项第 2 层技术,与以太网密切配合。要路由两个不同 VLAN 之间的包,需要使用第 3 层设备(如路由器)。

In this diagram, different VLANs are depicted in different color codes. Hosts in one VLAN, even if connected on the same Switch cannot see or speak to other hosts in different VLANs. VLAN is Layer-2 technology which works closely on Ethernet. To route packets between two different VLANs a Layer-3 device such as Router is required.

Computer Network Toplogies

网络拓扑是连接计算机系统或网络设备的排列方式。拓扑可能定义网络的物理和逻辑方面。在同一个网络中,逻辑拓扑和物理拓扑可能相同,也可能不同。

A Network Topology is the arrangement with which computer systems or network devices are connected to each other. Topologies may define both physical and logical aspect of the network. Both logical and physical topologies could be same or different in a same network.

Point-to-Point

点对点网络包含恰好两个主机,例如计算机、交换机或路由器,使用一根电缆背靠背连接的服务器。通常,一个主机的接收端连接到另一个主机的发送端,反之亦然。

Point-to-point networks contains exactly two hosts such as computer, switches or routers, servers connected back to back using a single piece of cable. Often, the receiving end of one host is connected to sending end of the other and vice-versa.

如果主机在逻辑上是点对点连接的,那么可能有多个中间设备。但是,最终主机不知道底层网络,并且会将对方视为直接连接。

If the hosts are connected point-to-point logically, then may have multiple intermediate devices. But the end hosts are unaware of underlying network and see each other as if they are connected directly.

Bus Topology

在总线拓扑的情况下,所有设备共享单条通信线路或电缆。当多个主机同时发送数据时,总线拓扑可能会出现问题。因此,总线拓扑使用 CSMA/CD 技术或识别一个主机为总线主设备来解决该问题。这是网络连接的一种简单形式,其中一台设备的故障不会影响其他设备。但是,共享通信线路的故障会导致所有其他设备停止运行。

In case of Bus topology, all devices share single communication line or cable.Bus topology may have problem while multiple hosts sending data at the same time. Therefore, Bus topology either uses CSMA/CD technology or recognizes one host as Bus Master to solve the issue. It is one of the simple forms of networking where a failure of a device does not affect the other devices. But failure of the shared communication line can make all other devices stop functioning.

bus topology

共享信道的两端都有线路终端器。数据仅在一个方向发送,并且一旦到达最远端,终端器就会从线路中删除数据。

Both ends of the shared channel have line terminator. The data is sent in only one direction and as soon as it reaches the extreme end, the terminator removes the data from the line.

Star Topology

星形拓扑中的所有主机都使用点对点连接连接到一个称为集线器设备的中央设备。也就是说,主机和集线器之间存在点对点连接。集线器设备可以是以下任一种设备:

All hosts in Star topology are connected to a central device, known as hub device, using a point-to-point connection. That is, there exists a point to point connection between hosts and hub. The hub device can be any of the following:

  1. Layer-1 device such as hub or repeater

  2. Layer-2 device such as switch or bridge

  3. Layer-3 device such as router or gateway

star topology

与总线拓扑一样,集线器充当单点故障。如果集线器发生故障,则所有主机与其他所有主机的连接都会失败。主机之间的每项通信都仅通过集线器进行。星型拓扑不需要高成本,因为连接一台主机只需要一根电缆,而且配置也很简单。

As in Bus topology, hub acts as single point of failure. If hub fails, connectivity of all hosts to all other hosts fails. Every communication between hosts, takes place through only the hub.Star topology is not expensive as to connect one more host, only one cable is required and configuration is simple.

Ring Topology

在环形拓扑中,每台主机连接到另外两台主机,创建了一个环形网络结构。当一台主机尝试与不与其相邻的主机通信或向其发送消息时,数据将通过所有中间主机进行传输。要在现有结构中连接一台主机,管理员可能只需要再使用一根电缆。

In ring topology, each host machine connects to exactly two other machines, creating a circular network structure. When one host tries to communicate or send message to a host which is not adjacent to it, the data travels through all intermediate hosts. To connect one more host in the existing structure, the administrator may need only one more extra cable.

ring topology

任何主机的故障都会导致整个环路的故障。因此,环路中的每个连接都是故障点。有些方法采用了另一个备份环路。

Failure of any host results in failure of the whole ring.Thus, every connection in the ring is a point of failure. There are methods which employ one more backup ring.

Mesh Topology

在这种类型的拓扑中,一台主机连接到一个或多个主机。该拓扑具有点对点连接的所有其他主机的点对点连接中的主机,或者也可能具有仅点对点连接到少数主机的点对点连接中的主机。

In this type of topology, a host is connected to one or multiple hosts.This topology has hosts in point-to-point connection with every other host or may also have hosts which are in point-to-point connection to few hosts only.

mesh topology

网状拓扑中的主机还充当其他没有直接点对点链路的主机的中继。网状技术分为两种类型:

Hosts in Mesh topology also work as relay for other hosts which do not have direct point-to-point links. Mesh technology comes into two types:

  1. Full Mesh: All hosts have a point-to-point connection to every other host in the network. Thus for every new host n(n-1)/2 connections are required. It provides the most reliable network structure among all network topologies.

  2. Partially Mesh: Not all hosts have point-to-point connection to every other host. Hosts connect to each other in some arbitrarily fashion. This topology exists where we need to provide reliability to some hosts out of all.

Tree Topology

它也被称为层次拓扑,这是目前使用最广泛的网络拓扑形式。该拓扑模拟为扩展星形拓扑并继承总线拓扑的特性。

Also known as Hierarchical Topology, this is the most common form of network topology in use presently.This topology imitates as extended Star topology and inherits properties of bus topology.

该拓扑将网络划分为多个网络层面/层级。主要在局域网中,网络分为三类网络设备。最下层是接入层,计算机附加在此处。中间层被称为分配层,它充当上层和下层之间的调解器。最高层被称为核心层,是网络的中心点,也是树的根,所有节点从中分叉。

This topology divides the network in to multiple levels/layers of network. Mainly in LANs, a network is bifurcated into three types of network devices. The lowermost is access-layer where computers are attached. The middle layer is known as distribution layer, which works as mediator between upper layer and lower layer. The highest layer is known as core layer, and is central point of the network, i.e. root of the tree from which all nodes fork.

tree topology

所有邻近主机在其之间进行点对点连接。类似于总线拓扑,如果根节点关闭,那么整个网络都会受到影响,即使它不是单点故障。每个连接都充当故障点,故障会导致网络划分为无法访问的片段。

All neighboring hosts have point-to-point connection between them.Similar to the Bus topology, if the root goes down, then the entire network suffers even.though it is not the single point of failure. Every connection serves as point of failure, failing of which divides the network into unreachable segment.

Daisy Chain

这种拓扑以线性方式连接所有主机。类似于环形拓扑,除端点主机外,所有主机仅连接到两台主机。这意味着,如果菊花链中的端点主机连接,则表示环形拓扑。

This topology connects all the hosts in a linear fashion. Similar to Ring topology, all hosts are connected to two hosts only, except the end hosts.Means, if the end hosts in daisy chain are connected then it represents Ring topology.

daisy chain topology

菊花链拓扑中的每个链路都表示单点故障。每个链路故障都会将网络分成两个部分。每个中间主机充当其直接主机的中继。

Each link in daisy chain topology represents single point of failure. Every link failure splits the network into two segments.Every intermediate host works as relay for its immediate hosts.

Hybrid Topology

包含多种拓扑设计的网络结构称为混合拓扑。混合拓扑继承了所有包含拓扑的优点和缺点。

A network structure whose design contains more than one topology is said to be hybrid topology. Hybrid topology inherits merits and demerits of all the incorporating topologies.

hybrid topology

上面的图片表示任意混合拓扑。组合拓扑可能包含星形、环形、总线和菊花链拓扑的属性。大多数广域网都通过双环拓扑连接,而连接到它们的网络大多是星形拓扑网络。互联网是最大的混合拓扑的最佳示例

The above picture represents an arbitrarily hybrid topology. The combining topologies may contain attributes of Star, Ring, Bus, and Daisy-chain topologies. Most WANs are connected by means of Dual-Ring topology and networks connected to them are mostly Star topology networks. Internet is the best example of largest Hybrid topology

Computer Network Models

网络工程是一项复杂的任务,涉及软件、固件、芯片级工程、硬件和电子脉冲。为了简化网络工程,整个网络概念被划分为多个层。每层涉及一些特定任务,且独立于所有其他层。但作为一个整体,几乎所有网络任务都依赖于这些层。层之间共享数据,它们彼此依赖才能接收输入并发送输出。

Networking engineering is a complicated task, which involves software, firmware, chip level engineering, hardware, and electric pulses. To ease network engineering, the whole networking concept is divided into multiple layers. Each layer is involved in some particular task and is independent of all other layers. But as a whole, almost all networking tasks depend on all of these layers. Layers share data between them and they depend on each other only to take input and send output.

Layered Tasks

在网络模型的分层架构中,整个网络进程被划分为小任务。然后,将每个小任务分配给一个特定层,该层只致力于处理任务。每层只做特定工作。

In layered architecture of Network Model, one whole network process is divided into small tasks. Each small task is then assigned to a particular layer which works dedicatedly to process the task only. Every layer does only specific work.

在分层通信系统中,一台主机的某个层处理由远程主机所做或准备由远程主机所做的任务,而且处理的任务位于远程主机同一级别的对等层。任务要么由最低层要么由最高层的层启动。如果任务由最高层启动,则向下传递给下一层以便进一步处理。下层做同样的事情,它处理任务并将其传递给下层。如果任务由最低层启动,则采取相反的路径。

In layered communication system, one layer of a host deals with the task done by or to be done by its peer layer at the same level on the remote host. The task is either initiated by layer at the lowest level or at the top most level. If the task is initiated by the-top most layer, it is passed on to the layer below it for further processing. The lower layer does the same thing, it processes the task and passes on to lower layer. If the task is initiated by lower most layer, then the reverse path is taken.

layered tasks

每一层都将执行其任务部分所需的所有过程、协议和方法集合在一起。所有层通过封装头和尾来识别其对应的层。

Every layer clubs together all procedures, protocols, and methods which it requires to execute its piece of task. All layers identify their counterparts by means of encapsulation header and tail.

OSI Model

开放系统互连是一种针对所有通信系统制定的开放式标准。OSI 模型由国际标准化组织 (ISO) 建立。此模型具有七层:

Open System Interconnect is an open standard for all communication systems. OSI model is established by International Standard Organization (ISO). This model has seven layers:

OSI model
  1. Application Layer: This layer is responsible for providing interface to the application user. This layer encompasses protocols which directly interact with the user.

  2. Presentation Layer: This layer defines how data in the native format of remote host should be presented in the native format of host.

  3. Session Layer: This layer maintains sessions between remote hosts. For example, once user/password authentication is done, the remote host maintains this session for a while and does not ask for authentication again in that time span.

  4. Transport Layer: This layer is responsible for end-to-end delivery between hosts.

  5. Network Layer: This layer is responsible for address assignment and uniquely addressing hosts in a network.

  6. Data Link Layer: This layer is responsible for reading and writing data from and onto the line. Link errors are detected at this layer.

  7. Physical Layer: This layer defines the hardware, cabling wiring, power output, pulse rate etc.

Internet Model

互联网使用 TCP/IP 协议套件,也称为 Internet 套件。这定义了包含 4 层架构的 Internet 模型。OSI 模型是通用通信模型,但 Internet 模型是互联网用于其所有通信的方式。互联网与其底层网络架构无关,其模型也是如此。此模型具有以下层:

Internet uses TCP/IP protocol suite, also known as Internet suite. This defines Internet Model which contains four layered architecture. OSI Model is general communication model but Internet Model is what the internet uses for all its communication.The internet is independent of its underlying network architecture so is its Model. This model has the following layers:

Internet model
  1. Application Layer: This layer defines the protocol which enables user to interact with the network.For example, FTP, HTTP etc.

  2. Transport Layer: This layer defines how data should flow between hosts. Major protocol at this layer is Transmission Control Protocol (TCP). This layer ensures data delivered between hosts is in-order and is responsible for end-to-end delivery.

  3. Internet Layer: Internet Protocol (IP) works on this layer. This layer facilitates host addressing and recognition. This layer defines routing.

  4. Link Layer: This layer provides mechanism of sending and receiving actual data.Unlike its OSI Model counterpart, this layer is independent of underlying network architecture and hardware.

Computer Network Security

在互联网的初期,其使用仅限于军方和大学,用于研究和开发目的。后来,当所有网络合并在一起并形成互联网时,数据用于通过公共传输网络传输。普通人可能会发送可能高度敏感的数据,例如其银行凭证、用户名和密码、个人文件、在线购物详情或机密文件。

During initial days of internet, its use was limited to military and universities for research and development purpose. Later when all networks merged together and formed internet, the data useds to travel through public transit network.Common people may send the data that can be highly sensitive such as their bank credentials, username and passwords, personal documents, online shopping details, or confidential documents.

所有安全威胁都是故意的,即仅在故意触发时才会发生。安全威胁可分为以下几类:

All security threats are intentional i.e. they occur only if intentionally triggered. Security threats can be divided into the following categories:

  1. Interruption

中断是一种安全威胁,该威胁会攻击资源的可用性。例如,用户无法访问其网络服务器或网络服务器被劫持。

Interruption is a security threat in which availability of resources is attacked. For example, a user is unable to access its web-server or the web-server is hijacked.

  1. Privacy-Breach

在此威胁中,用户的隐私受到损害。未经授权的人员正在访问或拦截原始经过身份验证的用户发送或接收的数据。

In this threat, the privacy of a user is compromised. Someone, who is not the authorized person is accessing or intercepting data sent or received by the original authenticated user.

  1. Integrity

此类型的威胁包括通信原始背景中的任何变更或修改。攻击者拦截并接收发送者发送的数据,然后攻击者修改或生成虚假数据并发送给接收者。接收者接收数据时假设数据是由原始发送者发送的。

This type of threat includes any alteration or modification in the original context of communication. The attacker intercepts and receives the data sent by the sender and the attacker then either modifies or generates false data and sends to the receiver. The receiver receives the data assuming that it is being sent by the original Sender.

  1. Authenticity

当攻击者或安全违规者冒充真人的身份并访问资源或与其他真正用户进行通信时,就会发生此威胁。

This threat occurs when an attacker or a security violator, poses as a genuine person and accesses the resources or communicates with other genuine users.

当今世界中没有一种技术可以提供 100% 的安全性。但是,可以采取措施来保护数据在不安全的网络或互联网中传输时的安全。使用最广泛的技术是密码术。

No technique in the present world can provide 100% security. But steps can be taken to secure data while it travels in unsecured network or internet. The most widely used technique is Cryptography.

cryptography

密码术是一种加密明文数据的技术,使得难以理解和解释数据。目前有几种可用的密码算法,如下所述:

Cryptography is a technique to encrypt the plain-text data which makes it difficult to understand and interpret. There are several cryptographic algorithms available present day as described below:

  1. Secret Key

  2. Public Key

  3. Message Digest

Secret Key Encryption

发送者和接收者都有一个密钥。此密钥用于在发送方端加密数据。在加密数据后,它将被发送到公有域,发送给接收者。因为接收者知道并拥有密钥,所以加密的数据包可以轻松解密。

Both sender and receiver have one secret key. This secret key is used to encrypt the data at sender’s end. After the data is encrypted, it is sent on the public domain to the receiver. Because the receiver knows and has the Secret Key, the encrypted data packets can easily be decrypted.

密钥加密的一个示例是数据加密标准 (DES)。在密钥加密中,网络中每个主机都需要一个单独的密钥,这使得管理变得很困难。

Example of secret key encryption is Data Encryption Standard (DES). In Secret Key encryption, it is required to have a separate key for each host on the network making it difficult to manage.

Public Key Encryption

在此加密系统中,每个用户都有自己的密钥,并且不在共享域中。密钥永远不会在公有域中显示。除了密钥之外,每个用户都有自己的公开密钥。公钥始终是公开的,由发送者用于加密数据。当用户收到加密数据时,他们可以通过自己的密钥轻松对其进行解密。

In this encryption system, every user has its own Secret Key and it is not in the shared domain. The secret key is never revealed on public domain. Along with secret key, every user has its own but public key. Public key is always made public and is used by Senders to encrypt the data. When the user receives the encrypted data, he can easily decrypt it by using its own Secret Key.

公钥加密的一个示例是 Rivest-Shamir-Adleman (RSA)。

Example of public key encryption is Rivest-Shamir-Adleman (RSA).

Message Digest

在此方法中,不发送实际数据,而是计算散列值并发送。另一端用户计算自己的散列值,并与刚刚接收的散列值进行比较。如果两个散列值匹配,则接受,否则拒绝。

In this method, actual data is not sent, instead a hash value is calculated and sent. The other end user, computes its own hash value and compares with the one just received.If both hash values are matched, then it is accepted otherwise rejected.

消息摘要的示例是 MD5 hash。它主要用于身份验证,其中用户密码与保存在服务器上的密码进行交叉核对。

Example of Message Digest is MD5 hashing. It is mostly used in authentication where user password is cross checked with the one saved on the server.

Physical Layer - Introduction

OSI 模型中的物理层承担着与实际硬件和信令机制交互的作用。物理层是 OSI 网络模型中唯一真正处理两个不同站点的物理连接的层。该层定义了用于表示二进制信号的硬件设备、布线、布线、频率、脉冲等。

Physical layer in the OSI model plays the role of interacting with actual hardware and signaling mechanism. Physical layer is the only layer of OSI network model which actually deals with the physical connectivity of two different stations. This layer defines the hardware equipment, cabling, wiring, frequencies, pulses used to represent binary signals etc.

物理层为数据链路层提供服务。数据链路层将帧移交给物理层。物理层将它们转换为代表二进制数据的电脉冲。然后通过有线或无线媒体发送二进制数据。

Physical layer provides its services to Data-link layer. Data-link layer hands over frames to physical layer. Physical layer converts them to electrical pulses, which represent binary data.The binary data is then sent over the wired or wireless media.

Signals

当数据通过物理介质发送时,它需要首先转换为电磁信号。数据本身可以是模拟的,例如人声,也可以是数字的,例如磁盘上的文件。模拟和数字数据都可以用数字或模拟信号表示。

When data is sent over physical medium, it needs to be first converted into electromagnetic signals. Data itself can be analog such as human voice, or digital such as file on the disk.Both analog and digital data can be represented in digital or analog signals.

  1. Digital Signals Digital signals are discrete in nature and represent sequence of voltage pulses. Digital signals are used within the circuitry of a computer system.

  2. *Analog Signals * Analog signals are in continuous wave form in nature and represented by continuous electromagnetic waves.

Transmission Impairment

当信号通过介质传播时,它们往往会变弱。这可能有许多原因,如下所示:

When signals travel through the medium they tend to deteriorate. This may have many reasons as given:

  1. Attenuation For the receiver to interpret the data accurately, the signal must be sufficiently strong.When the signal passes through the medium, it tends to get weaker.As it covers distance, it loses strength.

  2. Dispersion As signal travels through the media, it tends to spread and overlaps. The amount of dispersion depends upon the frequency used.

  3. Delay distortion Signals are sent over media with pre-defined speed and frequency. If the signal speed and frequency do not match, there are possibilities that signal reaches destination in arbitrary fashion. In digital media, this is very critical that some bits reach earlier than the previously sent ones.

  4. Noise Random disturbance or fluctuation in analog or digital signal is said to be Noise in signal, which may distort the actual information being carried. Noise can be characterized in one of the following class: Thermal Noise Heat agitates the electronic conductors of a medium which may introduce noise in the media. Up to a certain level, thermal noise is unavoidable. Intermodulation When multiple frequencies share a medium, their interference can cause noise in the medium. Intermodulation noise occurs if two different frequencies are sharing a medium and one of them has excessive strength or the component itself is not functioning properly, then the resultant frequency may not be delivered as expected. Crosstalk This sort of noise happens when a foreign signal enters into the media. This is because signal in one medium affects the signal of second medium. Impulse This noise is introduced because of irregular disturbances such as lightening, electricity, short-circuit, or faulty components. Digital data is mostly affected by this sort of noise.

Transmission Media

称为传输介质的信息在两个计算机系统之间的发送介质。传输介质有两种形式。

The media over which the information between two computer systems is sent, called transmission media. Transmission media comes in two forms.

  1. Guided Media All communication wires/cables are guided media, such as UTP, coaxial cables, and fiber Optics. In this media, the sender and receiver are directly connected and the information is send (guided) through it.

  2. Unguided Media Wireless or open air space is said to be unguided media, because there is no connectivity between the sender and receiver. Information is spread over the air, and anyone including the actual recipient may collect the information.

Channel Capacity

信息的传输速度称为信道容量。在数字世界中,我们将其计为数据速率。它取决于许多因素,例如:

The speed of transmission of information is said to be the channel capacity. We count it as data rate in digital world. It depends on numerous factors such as:

  1. Bandwidth:  The physical limitation of underlying media.

  2. Error-rate:  Incorrect reception of information because of noise.

  3. Encoding:  The number of levels used for signaling.

Multiplexing

多路复用是一种在单个介质上混合和发送多个数据流的技术。此技术需要称为多路复用器 (MUX) 的系统硬件来对数据流进行多路复用并将其发送到介质,以及从介质中获取信息并将其分发到不同目的地的解复用器 (DMUX)。

Multiplexing is a technique to mix and send multiple data streams over a single medium. This technique requires system hardware called multiplexer (MUX) for multiplexing the streams and sending them on a medium, and de-multiplexer (DMUX) which takes information from the medium and distributes to different destinations.

Switching

交换是一种从源头向目的地发送数据/信息但未直接连接的机制。网络具有互连设备,这些设备从直接连接的源获取数据,存储数据,分析数据,然后转发到最接近目的地的下一个互连设备。

Switching is a mechanism by which data/information sent from source towards destination which are not directly connected. Networks have interconnecting devices, which receives data from directly connected sources, stores data, analyze it and then forwards to the next interconnecting device closest to the destination.

交换可以分为:

Switching can be categorized as:

switching

Digital Transmission

数据或信息可以使用两种方式存储,模拟和数字。对于计算机来说,它必须采用离散的数字形式才能使用数据。与数据类似,信号也采用模拟和数字形式。为了以数字方式传输数据,它必须先被转换为数字形式。

Data or information can be stored in two ways, analog and digital. For a computer to use the data, it must be in discrete digital form.Similar to data, signals can also be in analog and digital form. To transmit data digitally, it needs to be first converted to digital form.

Digital-to-Digital Conversion

本部分解释了如何将数字数据转换为数字信号。它可以通过两种方式完成,线路编码和块编码。对于所有通信,都必须使用线路编码,而块编码是可选的。

This section explains how to convert digital data into digital signals. It can be done in two ways, line coding and block coding. For all communications, line coding is necessary whereas block coding is optional.

Line Coding

将数字数据转换为数字信号的过程称为线路编码。数字数据采用二进制格式。它在内部表示(存储)为一系列 1 和 0。

The process for converting digital data into digital signal is said to be Line Coding. Digital data is found in binary format.It is represented (stored) internally as series of 1s and 0s.

line coding

数字信号由离散信号表示,它表示数字数据。有三种可用的线路编码方案:

Digital signal is denoted by discreet signal, which represents digital data.There are three types of line coding schemes available:

line coding schemes

Uni-polar Encoding

单极编码方案使用单个电压电平来表示数据。在这种情况下,为了表示二进制 1,高电压会传输,为了表示 0,不会传输电压。它还被称为单极-不归零,因为不存在静止条件,即它表示 1 或 0。

Unipolar encoding schemes use single voltage level to represent data. In this case, to represent binary 1, high voltage is transmitted and to represent 0, no voltage is transmitted. It is also called Unipolar-Non-return-to-zero, because there is no rest condition i.e. it either represents 1 or 0.

Unipolar NRZ

Polar Encoding

极性编码方案使用多个电压电平来表示二进制值。极性编码有四种类型:

Polar encoding scheme uses multiple voltage levels to represent binary values. Polar encodings is available in four types:

  1. Polar Non-Return to Zero (Polar NRZ) It uses two different voltage levels to represent binary values. Generally, positive voltage represents 1 and negative value represents 0. It is also NRZ because there is no rest condition. NRZ scheme has two variants: NRZ-L and NRZ-I. NRZ-L changes voltage level at when a different bit is encountered whereas NRZ-I changes voltage when a 1 is encountered.

归零(RZ)NRZ 的问题在于,如果发送器和接收器的时钟不同步,接收器无法确定何时结束一个位和何时开始下一个位。RZ 使用三个电压电平,正电压表示 1,负电压表示 0,零电压表示无。信号会在位中改变,而不是在位之间改变。

. Return to Zero (RZ) Problem with NRZ is that the receiver cannot conclude when a bit ended and when the next bit is started, in case when sender and receiver’s clock are not synchronized. RZ uses three voltage levels, positive voltage to represent 1, negative voltage to represent 0 and zero voltage for none. Signals change during bits not between bits.

曼彻斯特这种编码方案结合了 RZ 和 NRZ-L。位时间分为两半。它在位中间过渡,并且在遇到不同位时改变相位。

. Manchester This encoding scheme is a combination of RZ and NRZ-L. Bit time is divided into two halves. It transits in the middle of the bit and changes phase when a different bit is encountered.

差分曼彻斯特这种编码方案结合了 RZ 和 NRZ-I。它也过渡在位的中间,但是仅在遇到 1 时改变相位。

. Differential Manchester This encoding scheme is a combination of RZ and NRZ-I. It also transit at the middle of the bit but changes phase only when 1 is encountered.

Bipolar Encoding

双极编码使用三个电压电平,即正、负和零。零电压表示二进制 0,位 1 通过交替正电压和负电压来表示。

Bipolar encoding uses three voltage levels, positive, negative and zero. Zero voltage represents binary 0 and bit 1 is represented by altering positive and negative voltages.

bipolar

Block Coding

为了确保接收到的数据帧的准确性,使用了冗余位。例如,在偶校验中,添加一个校验位,以便使帧中 1 的数量变为偶数。通过这种方式,位数会增加。这被称为块编码。

To ensure accuracy of the received data frame redundant bits are used. For example, in even-parity, one parity bit is added to make the count of 1s in the frame even. This way the original number of bits is increased. It is called Block Coding.

块编码以斜线表示法表示,mB/nB。这意味着,m 位块被 n 位块替换,其中 n > m。块编码涉及三个步骤:

Block coding is represented by slash notation, mB/nB.Means, m-bit block is substituted with n-bit block where n > m. Block coding involves three steps:

  1. Division,

  2. Substitution

  3. Combination.

完成块编码后,对它进行线路编码以进行传输。

After block coding is done, it is line coded for transmission.

Analog-to-Digital Conversion

麦克风会产生模拟语音,摄像机会产生模拟视频,它们被视为模拟数据。为了通过数字信号传输这种模拟数据,我们需要进行模数转换。

Microphones create analog voice and camera creates analog videos, which are treated is analog data. To transmit this analog data over digital signals, we need analog to digital conversion.

模拟数据是波形中的连续数据流,而数字数据是离散的。为了将模拟波转换为数字数据,我们使用脉冲编码调制 (PCM)。

Analog data is a continuous stream of data in the wave form whereas digital data is discrete. To convert analog wave into digital data, we use Pulse Code Modulation (PCM).

PCM 是将模拟数据转换为数字形式最常用的方法之一。它涉及三个步骤:

PCM is one of the most commonly used method to convert analog data into digital form. It involves three steps:

  1. Sampling

  2. Quantization

  3. Encoding.

Sampling

sampling

模拟信号在每个 T 间隔取样。取样的最重要的因素是模拟信号取样的速率。根据奈奎斯特定理,取样速率必须至少为信号最高频率的两倍。

The analog signal is sampled every T interval. Most important factor in sampling is the rate at which analog signal is sampled. According to Nyquist Theorem, the sampling rate must be at least two times of the highest frequency of the signal.

Quantization

quantization

取样产生连续模拟信号的离散形式。每个离散模式显示该时刻模拟信号的幅度。量化是在最大幅度值和最小幅度值之间进行的。量化是对瞬时模拟值的近似。

Sampling yields discrete form of continuous analog signal. Every discrete pattern shows the amplitude of the analog signal at that instance. The quantization is done between the maximum amplitude value and the minimum amplitude value. Quantization is approximation of the instantaneous analog value.

Encoding

encoding

在编码中,每个近似值然后被转换成二进制格式。

In encoding, each approximated value is then converted into binary format.

Transmission Modes

传输模式决定了数据如何在两台计算机之间传输。1 和 0 形式的二进制数据可以通过两种不同的模式发送:并行和串行。

The transmission mode decides how data is transmitted between two computers.The binary data in the form of 1s and 0s can be sent in two different modes: Parallel and Serial.

Parallel Transmission

parallel

二进制位被组织成定长的组。发送器和接收器都通过等量的数据线并行连接。这两台计算机都区分高位和低位数据线。发送器一次在所有线上发送所有位。由于数据线等于一组或数据帧中的位数,因此一组完整的位(数据帧)一次发送。并行传输的优点是速度快,缺点是导线成本,因为它等于并行发送的比特数。

The binary bits are organized in-to groups of fixed length. Both sender and receiver are connected in parallel with the equal number of data lines. Both computers distinguish between high order and low order data lines. The sender sends all the bits at once on all lines.Because the data lines are equal to the number of bits in a group or data frame, a complete group of bits (data frame) is sent in one go. Advantage of Parallel transmission is high speed and disadvantage is the cost of wires, as it is equal to the number of bits sent in parallel.

Serial Transmission

在串行传输中,位在队列方式下逐个发送。串行传输只需要一个通信通道。

In serial transmission, bits are sent one after another in a queue manner. Serial transmission requires only one communication channel.

serial

串行传输可以是异步或同步的。

Serial transmission can be either asynchronous or synchronous.

Asynchronous Serial Transmission

之所以这么命名,是因为没有时间的重要性。数据位有特定的模式,它们帮助接收器识别开始和结束数据位。例如,每个数据字节前缀一个 0,并在末尾添加一个或多个 1。

It is named so because there’is no importance of timing. Data-bits have specific pattern and they help receiver recognize the start and end data bits.For example, a 0 is prefixed on every data byte and one or more 1s are added at the end.

两个连续的数据帧(字节)之间可能存在间隙。

Two continuous data-frames (bytes) may have a gap between them.

Synchronous Serial Transmission

同步传输中的时序很重要,因为没有机制遵循来识别开始和结束数据位。没有模式或前缀/后缀方法。数据位以突发模式发送,在字节(8 位)之间不保持间隙。单个数据位突发可能包含多个字节。因此,时序变得非常重要。

Timing in synchronous transmission has importance as there is no mechanism followed to recognize start and end data bits.There is no pattern or prefix/suffix method. Data bits are sent in burst mode without maintaining gap between bytes (8-bits). Single burst of data bits may contain a number of bytes. Therefore, timing becomes very important.

由接收器识别和将位分隔为字节。同步传输的优点是速度快,而且没有异步传输中额外的报头和报尾位的开销。

It is up to the receiver to recognize and separate bits into bytes.The advantage of synchronous transmission is high speed, and it has no overhead of extra header and footer bits as in asynchronous transmission.

Analog Transmission

将数字数据通过模拟媒体发送时,需要将其转换为模拟信号。根据数据格式会有两种情况。

To send the digital data over an analog media, it needs to be converted into analog signal.There can be two cases according to data formatting.

*带通:*滤波器用于滤除和传递感兴趣的频率。带通是一组可以传递滤波器的频率。

*Bandpass:*The filters are used to filter and pass frequencies of interest. A bandpass is a band of frequencies which can pass the filter.

Low-pass: 低通是一种传递低频信号的滤波器。

Low-pass: Low-pass is a filter that passes low frequencies signals.

当数字数据被转换成带通模拟信号时,这被称为数模转换。当低通模拟信号被转换成带通模拟信号时,这被称为模数转换。

When digital data is converted into a bandpass analog signal, it is called digital-to-analog conversion. When low-pass analog signal is converted into bandpass analog signal, it is called analog-to-analog conversion.

Digital-to-Analog Conversion

当从一台计算机发送数据到另一台计算机通过某些模拟载波时,它首先被转换为模拟信号。模拟信号被改变以反映数字数据。

When data from one computer is sent to another via some analog carrier, it is first converted into analog signals. Analog signals are modified to reflect digital data.

模拟信号由其幅度、频率和相位来表征。有三种数模转换:

An analog signal is characterized by its amplitude, frequency, and phase. There are three kinds of digital-to-analog conversions:

  1. Amplitude Shift Keying In this conversion technique, the amplitude of analog carrier signal is modified to reflect binary data. When binary data represents digit 1, the amplitude is held; otherwise it is set to 0. Both frequency and phase remain same as in the original carrier signal.

  2. Frequency Shift Keying In this conversion technique, the frequency of the analog carrier signal is modified to reflect binary data. This technique uses two frequencies, f1 and f2. One of them, for example f1, is chosen to represent binary digit 1 and the other one is used to represent binary digit 0. Both amplitude and phase of the carrier wave are kept intact.

  3. Phase Shift Keying In this conversion scheme, the phase of the original carrier signal is altered to reflect the binary data. When a new binary symbol is encountered, the phase of the signal is altered. Amplitude and frequency of the original carrier signal is kept intact.

  4. Quadrature Phase Shift Keying QPSK alters the phase to reflect two binary digits at once. This is done in two different phases. The main stream of binary data is divided equally into two sub-streams. The serial data is converted in to parallel in both sub-streams and then each stream is converted to digital signal using NRZ technique. Later, both the digital signals are merged together.

Analog-to-Analog Conversion

模拟信号被修改以表示模拟数据。这种转换也称为模拟调制。当使用带通时需要模拟调制。模拟到模拟的转换可以通过三种方式完成:

Analog signals are modified to represent analog data. This conversion is also known as Analog Modulation. Analog modulation is required when bandpass is used. Analog to analog conversion can be done in three ways:

analog modulation
  1. Amplitude Modulation In this modulation, the amplitude of the carrier signal is modified to reflect the analog data. Amplitude modulation is implemented by means of a multiplier. The amplitude of modulating signal (analog data) is multiplied by the amplitude of carrier frequency, which then reflects analog data. The frequency and phase of carrier signal remain unchanged.

  2. Frequency Modulation In this modulation technique, the frequency of the carrier signal is modified to reflect the change in the voltage levels of the modulating signal (analog data). The amplitude and phase of the carrier signal are not altered.

  3. Phase Modulation In the modulation technique, the phase of carrier signal is modulated in order to reflect the change in voltage (amplitude) of analog data signal. Phase modulation is practically similar to Frequency Modulation, but in Phase modulation frequency of the carrier signal is not increased. Frequency of carrier is signal is changed (made dense and sparse) to reflect voltage change in the amplitude of modulating signal.

Transmission Media

传输媒体只不过是在计算机网络中进行通信的物理媒体。

The transmission media is nothing but the physical media over which communication takes place in computer networks.

Magnetic Media

在网络诞生之前,从一台计算机向另一台计算机传输数据的最方便的方法之一就是将其保存在某些存储媒体上,然后在不同站点之间进行物理传输。尽管在当今高速互联网时代,这似乎是一种老套的方法,但是当数据量巨大时,磁性媒体就会发挥作用。

One of the most convenient way to transfer data from one computer to another, even before the birth of networking, was to save it on some storage media and transfer physical from one station to another. Though it may seem old-fashion way in today’s world of high speed internet, but when the size of data is huge, the magnetic media comes into play.

例如,一家银行必须处理和传输其客户的巨量数据,出于安全原因和为了避免不确定的灾难,它在某些遥远的地方存储数据备份。如果银行需要存储其大量的备份数据,那么通过互联网传输是不可行的。广域网链路可能不支持如此高的速度。即使支持,成本也过高。

For example, a bank has to handle and transfer huge data of its customer, which stores a backup of it at some geographically far-away place for security reasons and to keep it from uncertain calamities. If the bank needs to store its huge backup data then its,transfer through internet is not feasible.The WAN links may not support such high speed.Even if they do; the cost too high to afford.

在这些情况下,数据备份存储在磁带上或磁碟上,然后在远程位置进行物理转移。

In these cases, data backup is stored onto magnetic tapes or magnetic discs, and then shifted physically at remote places.

Twisted Pair Cable

双绞线由两根绝缘的塑料铜线绞合在一起形成一个单一介质。在这两根线中,只有一根承载实际信号,另一根用于接地参考。线之间的扭曲有助于减少噪声(电磁干扰)和串扰。

A twisted pair cable is made of two plastic insulated copper wires twisted together to form a single media. Out of these two wires, only one carries actual signal and another is used for ground reference. The twists between wires are helpful in reducing noise (electro-magnetic interference) and crosstalk.

twisted pairs

双绞线电缆有两种类型:

There are two types of twisted pair cables:

  1. Shielded Twisted Pair (STP) Cable

  2. Unshielded Twisted Pair (UTP) Cable

STP 电缆带金属箔覆盖的绞合线对。这使得它对噪音和串扰更不敏感。

STP cables comes with twisted wire pair covered in metal foil. This makes it more indifferent to noise and crosstalk.

UTP 有七类,每类适用于特定的用途。在计算机网络中,最常使用 Cat-5、Cat-5e 和 Cat-6 电缆。UTP 电缆通过 RJ45 连接器连接。

UTP has seven categories, each suitable for specific use. In computer networks, Cat-5, Cat-5e, and Cat-6 cables are mostly used. UTP cables are connected by RJ45 connectors.

Coaxial Cable

同轴电缆有两根铜线。芯线位于中心,由实心导体制成。芯线被包在绝缘护套中。第二根线缠绕在护套上,反过来也被绝缘护套包覆。这一切都覆盖着塑料护套。

Coaxial cable has two wires of copper. The core wire lies in the center and it is made of solid conductor.The core is enclosed in an insulating sheath.The second wire is wrapped around over the sheath and that too in turn encased by insulator sheath.This all is covered by plastic cover.

coaxial cable

同轴电缆由于其结构,能够承载比双绞线电缆更高的频率信号。环绕结构为其提供了针对噪声和串扰的良好屏蔽。同轴电缆提供高达 450 mbps 的高带宽速率。

Because of its structure,the coax cable is capable of carrying high frequency signals than that of twisted pair cable.The wrapped structure provides it a good shield against noise and cross talk. Coaxial cables provide high bandwidth rates of up to 450 mbps.

同轴电缆有三个类别,即 RG-59(有线电视)、RG-58(细以太网)和 RG-11(粗以太网)。RG 代表无线电政府。

There are three categories of coax cables namely, RG-59 (Cable TV), RG-58 (Thin Ethernet), and RG-11 (Thick Ethernet). RG stands for Radio Government.

电缆使用 BNC 连接器和 BNC-T 连接。BNC 终端用于在远端端接电线。

Cables are connected using BNC connector and BNC-T. BNC terminator is used to terminate the wire at the far ends.

Power Lines

电力线通信(PLC)是一种使用电源线传输数据信号的第 1 层(物理层)技术。在 PLC 中,调制数据通过电缆发送。另一端的接收器解调并解释数据。

Power Line communication (PLC) is Layer-1 (Physical Layer) technology which uses power cables to transmit data signals.In PLC, modulated data is sent over the cables. The receiver on the other end de-modulates and interprets the data.

由于电力线的广泛部署,PLC 可以对所有带电设备进行控制和监控。PLC 采用半双工工作模式。

Because power lines are widely deployed, PLC can make all powered devices controlled and monitored. PLC works in half-duplex.

有两种类型的 PLC:

There are two types of PLC:

  1. Narrow band PLC

  2. Broad band PLC

窄带 PLC 提供较低的数据速率,最高可达数百 kbps,因为它们的工作频率较低(3-5000 kHz)。它们可以延伸数公里。

Narrow band PLC provides lower data rates up to 100s of kbps, as they work at lower frequencies (3-5000 kHz).They can be spread over several kilometers.

宽带 PLC 提供较高的数据速率,最高可达数百 Mbps,并以较高的频率工作(1.8 – 250 MHz)。它们的延伸距离不如窄带 PLC。

Broadband PLC provides higher data rates up to 100s of Mbps and works at higher frequencies (1.8 – 250 MHz).They cannot be as much extended as Narrowband PLC.

Fiber Optics

光纤利用光线的特性工作。当光线以临界角射入时,它会倾向于以 90 度折射。这种特性已应用于光纤中。光纤电缆的纤芯由高品质玻璃或塑料制成。从它的一端发射光,光穿过它并在另一端由光探测器探测光流并将其转换为电气数据。

Fiber Optic works on the properties of light. When light ray hits at critical angle it tends to refracts at 90 degree. This property has been used in fiber optic. The core of fiber optic cable is made of high quality glass or plastic. From one end of it light is emitted, it travels through it and at the other end light detector detects light stream and converts it to electric data.

光纤提供最高的速度模式。它有两种模式,一种是单模光纤,另一种是多模光纤。单模光纤可以传输单束光,而多模光纤可以传输多束光。

Fiber Optic provides the highest mode of speed. It comes in two modes, one is single mode fiber and second is multimode fiber. Single mode fiber can carry a single ray of light whereas multimode is capable of carrying multiple beams of light.

fiber optics

光纤还具有单向和双向传输功能。要连接和访问光纤,需要使用特殊类型的连接器。这些可以是用户信道 (SC)、直头 (ST) 或 MT-RJ。

Fiber Optic also comes in unidirectional and bidirectional capabilities. To connect and access fiber optic special type of connectors are used. These can be Subscriber Channel (SC), Straight Tip (ST), or MT-RJ.

Wireless Transmission

无线传输是一种非导引介质形式。无线通信涉及两台或多台设备通过无线进行通信而无需建立物理链路。无线信号散布在空气中,并由合适的接收天线接收和解读。

Wireless transmission is a form of unguided media. Wireless communication involves no physical link established between two or more devices, communicating wirelessly. Wireless signals are spread over in the air and are received and interpreted by appropriate antennas.

当天线连接到计算机或无线设备的电气电路时,它会将数字数据转换成无线信号并在其频率范围内全部传播。另一端的接收器接收这些信号并将其转换回数字数据。

When an antenna is attached to electrical circuit of a computer or wireless device, it converts the digital data into wireless signals and spread all over within its frequency range. The receptor on the other end receives these signals and converts them back to digital data.

电磁频谱的一小部分可用于无线传输。

A little part of electromagnetic spectrum can be used for wireless transmission.

electromagnetic spectrum

Radio Transmission

射频更容易产生,并且由于其波长较长,它可以穿透墙壁和类似的结构。电波的波长可以从 1 毫米到 100,000 公里,频率范围从 3 赫兹(极低频)到 300 吉赫兹(极高频)。射频分为六个频段。

Radio frequency is easier to generate and because of its large wavelength it can penetrate through walls and structures alike.Radio waves can have wavelength from 1 mm – 100,000 km and have frequency ranging from 3 Hz (Extremely Low Frequency) to 300 GHz (Extremely High Frequency). Radio frequencies are sub-divided into six bands.

较低频率的电波可以穿透墙壁,而较高的射频可以直线传播并反弹。低频波的功率在长距离传播时会急剧下降。高频电波的功率更大。

Radio waves at lower frequencies can travel through walls whereas higher RF can travel in straight line and bounce back.The power of low frequency waves decreases sharply as they cover long distance. High frequency radio waves have more power.

极低频、低频、中频等较低频率可以在地面上传播长达 1000 公里,跨越地球表面。

Lower frequencies such as VLF, LF, MF bands can travel on the ground up to 1000 kilometers, over the earth’s surface.

radio wave grounded

高频电波容易被雨水和其他障碍物吸收。它们利用地球大气层的电离层。高频电波如高频和甚高频波段向上传播。到达电离层时,它们会被折射回地球。

Radio waves of high frequencies are prone to be absorbed by rain and other obstacles. They use Ionosphere of earth atmosphere. High frequency radio waves such as HF and VHF bands are spread upwards. When they reach Ionosphere, they are refracted back to the earth.

radio wave ionosphere

Microwave Transmission

100 兆赫以上的电磁波倾向于直线传播,并且可以通过将这些波束射向一个特定的工作站来发送信号。由于微波以直线传播,发送器和接收器都必须严格地对准在视线范围内。

Electromagnetic waves above 100 MHz tend to travel in a straight line and signals over them can be sent by beaming those waves towards one particular station. Because Microwaves travels in straight lines, both sender and receiver must be aligned to be strictly in line-of-sight.

微波的波长范围为 1 毫米 – 1 米,频率范围为 300 MHz 到 300 GHz。

Microwaves can have wavelength ranging from 1 mm – 1 meter and frequency ranging from 300 MHz to 300 GHz.

microwave

微波天线通过将波聚焦汇聚成一个波束。如图所示,可以对多个天线进行对齐以实现更远的传输距离。微波具有较高的频率,并且不会像障碍物一样穿透墙壁。

Microwave antennas concentrate the waves making a beam of it. As shown in picture above, multiple antennas can be aligned to reach farther. Microwaves have higher frequencies and do not penetrate wall like obstacles.

微波传输很大程度上取决于天气条件及其使用的频率。

Microwave transmission depends highly upon the weather conditions and the frequency it is using.

Infrared Transmission

红外波位于可见光谱和微波之间。它的波长为 700-nm 至 1-mm,频率范围为 300-GHz 至 430-THz。

Infrared wave lies in between visible light spectrum and microwaves. It has wavelength of 700-nm to 1-mm and frequency ranges from 300-GHz to 430-THz.

红外波用于电视和遥控器等非常短程通信目的。红外波呈直线传播,因此本质上是定向的。由于频率范围高,红外波无法穿透墙等障碍物。

Infrared wave is used for very short range communication purposes such as television and it’s remote. Infrared travels in a straight line hence it is directional by nature. Because of high frequency range, Infrared cannot cross wall-like obstacles.

Light Transmission

用于数据传输的最高电磁频谱是光或光学信号。这是通过激光实现的。

Highest most electromagnetic spectrum which can be used for data transmission is light or optical signaling. This is achieved by means of LASER.

由于频率光线的使用,它倾向于严格地沿直线传播。因此,发送器和接收器必须处于视线范围内。由于激光传输是单向的,因此需要在通信的两端安装激光器和光电探测器。激光束通常宽 1 毫米,因此精确对齐两个遥远的接收器以指向激光源是一项精细工作。

Because of frequency light uses, it tends to travel strictly in straight line.Hence the sender and receiver must be in the line-of-sight. Because laser transmission is unidirectional, at both ends of communication the laser and the photo-detector needs to be installed. Laser beam is generally 1mm wide hence it is a work of precision to align two far receptors each pointing to lasers source.

light transmission

激光器用作 Tx(发送器),光电探测器用作 Rx(接收器)。

Laser works as Tx (transmitter) and photo-detectors works as Rx (receiver).

激光不能穿透障碍物,如墙壁、雨和浓雾。此外,激光束会因风、大气温度或路径中的温度变化而失真。

Lasers cannot penetrate obstacles such as walls, rain, and thick fog. Additionally, laser beam is distorted by wind, atmosphere temperature, or variation in temperature in the path.

激光对于数据传输是安全的,因为在不中断通信信道的情况下窃听 1 毫米宽的激光非常困难。

Laser is safe for data transmission as it is very difficult to tap 1mm wide laser without interrupting the communication channel.

Multiplexing

多路复用是一种技术,通过该技术可以同时通过共享链路处理不同的模拟和数字传输流。多路复用将大容量介质分成低容量逻辑介质,然后由不同的流共享。

Multiplexing is a technique by which different analog and digital streams of transmission can be simultaneously processed over a shared link. Multiplexing divides the high capacity medium into low capacity logical medium which is then shared by different streams.

可以通过无线(射频)、使用物理介质(电缆)和光(光纤)进行通信。所有介质都具有多路复用功能。

Communication is possible over the air (radio frequency), using a physical media (cable), and light (optical fiber). All mediums are capable of multiplexing.

当多个发送方尝试通过单一介质发送时,一种称为多路复用器的设备会划分物理信道,并为每个信道分配一个。在通信的另一端,一个解复用器从单个介质接收数据,识别它们,并发送给不同的接收器。

When multiple senders try to send over a single medium, a device called Multiplexer divides the physical channel and allocates one to each. On the other end of communication, a De-multiplexer receives data from a single medium, identifies each, and sends to different receivers.

Frequency Division Multiplexing

当载波为频率时,使用 FDM。FDM 是一种模拟技术。FDM 将频谱或载波带宽划分为逻辑信道,并为每个信道分配一个用户。每个用户都可以独立使用信道频率,并对其具有独占访问权。所有信道都被划分,从而彼此不重叠。信道由保护带分开。保护带是任何信道都不使用的频率。

When the carrier is frequency, FDM is used. FDM is an analog technology. FDM divides the spectrum or carrier bandwidth in logical channels and allocates one user to each channel. Each user can use the channel frequency independently and has exclusive access of it. All channels are divided in such a way that they do not overlap with each other. Channels are separated by guard bands. Guard band is a frequency which is not used by either channel.

fdm

Time Division Multiplexing

TDM 主要应用于数字信号,但也可以应用于模拟信号。在 TDM 中,共享信道通过时隙分配给其用户。每个用户只能在提供的时隙内传输数据。数字信号被划分为帧,相当于时隙,即可以在给定的时隙内传输的最佳大小的帧。

TDM is applied primarily on digital signals but can be applied on analog signals as well. In TDM the shared channel is divided among its user by means of time slot. Each user can transmit data within the provided time slot only. Digital signals are divided in frames, equivalent to time slot i.e. frame of an optimal size which can be transmitted in given time slot.

TDM 以同步模式工作。两端(即多路复用器和解复用器)都及时同步,并且都同时切换到下一个信道。

TDM works in synchronized mode. Both ends, i.e. Multiplexer and De-multiplexer are timely synchronized and both switch to next channel simultaneously.

tdm

当信道 A 在一端传输其帧时,解复用器在另一端为信道 A 提供介质。一旦信道 A 的时隙到期,这端就会切换到信道 B。在另一端,解复用器以同步方式工作,并为信道 B 提供介质。来自不同信道的信号交错地传输路径。

When channel A transmits its frame at one end,the De-multiplexer provides media to channel A on the other end.As soon as the channel A’s time slot expires, this side switches to channel B. On the other end, the De-multiplexer works in a synchronized manner and provides media to channel B. Signals from different channels travel the path in interleaved manner.

Wavelength Division Multiplexing

光有不同的波长(颜色)。在光纤模式中,通过使用不同的波长将多个光载波信号多路复用到光纤中。这是一种模拟多路复用技术,在概念上与 FDM 相同,但使用光作为信号。

Light has different wavelength (colors). In fiber optic mode, multiple optical carrier signals are multiplexed into an optical fiber by using different wavelengths. This is an analog multiplexing technique and is done conceptually in the same manner as FDM but uses light as signals.

wdm

此外,可以在每个波长上整合时分多路复用,以容纳更多的数据信号。

Further, on each wavelength time division multiplexing can be incorporated to accommodate more data signals.

Code Division Multiplexing

可以通过使用码分多路复用通过单一频率传输多个数据信号。FDM 将频率分成较小的信道,但 CDM 允许其用户全带宽,并且使用唯一码始终传输信号。CDM 使用正交码来扩展信号。

Multiple data signals can be transmitted over a single frequency by using Code Division Multiplexing. FDM divides the frequency in smaller channels but CDM allows its users to full bandwidth and transmit signals all the time using a unique code. CDM uses orthogonal codes to spread signals.

每个站点都会分配一个称为码片的唯一码。信号在整个带宽内使用这些码片独立传输。接收器预先知道它必须接收的码片码信号。

Each station is assigned with a unique code, called chip. Signals travel with these codes independently, inside the whole bandwidth.The receiver knows in advance the chip code signal it has to receive.

Network Switching

交换是将来自一个端口的数据包转发到通向目标的端口的过程。当数据进入一个端口时,称为入口;当数据离开一个端口或发出时,称为出口。通信系统可能包括许多交换机和节点。总体来说,交换可以分为两类:

Switching is process to forward packets coming in from one port to a port leading towards the destination. When data comes on a port it is called ingress, and when data leaves a port or goes out it is called egress. A communication system may include number of switches and nodes. At broad level, switching can be divided into two major categories:

  1. Connectionless: The data is forwarded on behalf of forwarding tables. No previous handshaking is required and acknowledgements are optional.

  2. Connection Oriented:  Before switching data to be forwarded to destination, there is a need to pre-establish circuit along the path between both endpoints. Data is then forwarded on that circuit. After the transfer is completed, circuits can be kept for future use or can be turned down immediately.

Circuit Switching

当两个节点通过专用通信路径彼此通信时,这称为电路交换,需要一条预先指定的数据传输路线,不允许其他数据传输。在电路交换中,为了传输数据,必须建立电路,以便进行数据传输。

When two nodes communicate with each other over a dedicated communication path, it is called circuit switching.There 'is a need of pre-specified route from which data will travels and no other data is permitted.In circuit switching, to transfer the data, circuit must be established so that the data transfer can take place.

电路可以是永久的或临时的。使用电路交换的应用程序可能必须经历三个阶段:

Circuits can be permanent or temporary. Applications which use circuit switching may have to go through three phases:

  1. Establish a circuit

  2. Transfer the data

  3. Disconnect the circuit

circuit switching

电路交换是为语音应用程序设计的。电话是最适合的电路交换示例。在用户拨打电话之前,必须在网络上建立呼叫者和被叫者之间的虚拟路径。

Circuit switching was designed for voice applications. Telephone is the best suitable example of circuit switching. Before a user can make a call, a virtual path between caller and callee is established over the network.

Message Switching

这种技术介于电路交换和分组交换之间。在报文交换中,整个报文被视为一个数据单元,并完整交换/传输。

This technique was somewhere in middle of circuit switching and packet switching. In message switching, the whole message is treated as a data unit and is switching / transferred in its entirety.

使用报文交换工作的交换机首先接收整个报文,并将其缓冲,直到有可用于将其传输到下一个跳跃的资源。如果下一个跳跃没有足够的资源来容纳大尺寸报文,则存储报文,然后交换机等待。

A switch working on message switching, first receives the whole message and buffers it until there are resources available to transfer it to the next hop. If the next hop is not having enough resource to accommodate large size message, the message is stored and switch waits.

message switching

这种技术被认为是对电路交换的替代。与电路交换中的为两个实体完全阻塞路径不同,报文交换被分组交换所取代。报文交换具有以下缺点:

This technique was considered substitute to circuit switching. As in circuit switching the whole path is blocked for two entities only. Message switching is replaced by packet switching. Message switching has the following drawbacks:

  1. Every switch in transit path needs enough storage to accommodate entire message.

  2. Because of store-and-forward technique and waits included until resources are available, message switching is very slow.

  3. Message switching was not a solution for streaming media and real-time applications.

Packet Switching

消息交换的不足之处催生了一种分组交换的思想。整个消息被分解成更小的块,称为分组。交换信息被添加到每个分组的头部并独立传输。

Shortcomings of message switching gave birth to an idea of packet switching. The entire message is broken down into smaller chunks called packets. The switching information is added in the header of each packet and transmitted independently.

中间网络设备更容易存储小尺寸分组,而且它们在载波路径或交换机的内部存储器中也不会占用太多的资源。

It is easier for intermediate networking devices to store small size packets and they do not take much resources either on carrier path or in the internal memory of switches.

packet switching

分组交换提高了线路效率,因为可以将来自多个应用程序的分组多路复用到载波上。互联网使用分组交换技术。分组交换使用户能够根据优先级区分数据流。分组根据其优先级进行存储和转发,以提供服务质量。

Packet switching enhances line efficiency as packets from multiple applications can be multiplexed over the carrier. The internet uses packet switching technique. Packet switching enables the user to differentiate data streams based on priorities. Packets are stored and forwarded according to their priority to provide quality of service.

数据链路层是 OSI 分层模型的第二层。该层是最复杂的层之一,具有复杂的功能和责任。数据链路层隐藏底层硬件的详细信息,并且将自己表示为上层通信的介质。

Data Link Layer is second layer of OSI Layered Model. This layer is one of the most complicated layers and has complex functionalities and liabilities. Data link layer hides the details of underlying hardware and represents itself to upper layer as the medium to communicate.

数据链路层在以某种意义上直接连接的两个主机之间工作。这种直接连接可能是点对点或广播。广播网络上的系统据说在同一条链路上。当数据链路层处理单个碰撞域上的多个主机时,其工作往往变得更加复杂。

Data link layer works between two hosts which are directly connected in some sense. This direct connection could be point to point or broadcast. Systems on broadcast network are said to be on same link. The work of data link layer tends to get more complex when it is dealing with multiple hosts on single collision domain.

数据链路层负责逐位将数据流转换为信号并通过底层硬件发送。在接收端,数据链路层从硬件中获取以电信号形式存在的数据,将它们组装成可识别的帧格式,并移交给上层。

Data link layer is responsible for converting data stream to signals bit by bit and to send that over the underlying hardware. At the receiving end, Data link layer picks up data from hardware which are in the form of electrical signals, assembles them in a recognizable frame format, and hands over to upper layer.

数据链路层有两个子层:

Data link layer has two sub-layers:

  1. Logical Link Control: It deals with protocols, flow-control, and error control

  2. Media Access Control: It deals with actual control of media

数据链路层代表上层执行许多任务。这些任务有:

Data link layer does many tasks on behalf of upper layer. These are:

  1. Framing Data-link layer takes packets from Network Layer and encapsulates them into Frames.Then, it sends each frame bit-by-bit on the hardware. At receiver’ end, data link layer picks up signals from hardware and assembles them into frames.

  2. Addressing Data-link layer provides layer-2 hardware addressing mechanism. Hardware address is assumed to be unique on the link. It is encoded into hardware at the time of manufacturing.

  3. Synchronization When data frames are sent on the link, both machines must be synchronized in order to transfer to take place.

  4. Error Control Sometimes signals may have encountered problem in transition and the bits are flipped.These errors are detected and attempted to recover actual data bits. It also provides error reporting mechanism to the sender.

  5. Flow Control Stations on same link may have different speed or capacity. Data-link layer ensures flow control that enables both machine to exchange data on same speed.

  6. Multi-Access When host on the shared link tries to transfer the data, it has a high probability of collision. Data-link layer provides mechanism such as CSMA/CD to equip capability of accessing a shared media among multiple Systems.

Error Detection and Correction

有很多原因,如噪音、串扰等,可能导致数据在传输过程中损坏。上层根据网络架构的一些概括视图工作,并不了解实际的硬件数据处理。因此,上层期望在系统之间进行无差错传输。如果应用程序接收到错误的数据,大多数应用程序将无法按预期工作。语音和视频等应用程序可能不会受到影响,即使出现一些错误,它们仍然可能正常工作。

There are many reasons such as noise, cross-talk etc., which may help data to get corrupted during transmission. The upper layers work on some generalized view of network architecture and are not aware of actual hardware data processing.Hence, the upper layers expect error-free transmission between the systems. Most of the applications would not function expectedly if they receive erroneous data. Applications such as voice and video may not be that affected and with some errors they may still function well.

数据链路层使用一些错误控制机制来确保帧(数据位流)以一定的准确度传输。但是要了解如何控制错误,必须知道可能出现哪种类型的错误。

Data-link layer uses some error control mechanism to ensure that frames (data bit streams) are transmitted with certain level of accuracy. But to understand how errors is controlled, it is essential to know what types of errors may occur.

Types of Errors

可能出现三种类型的错误:

There may be three types of errors:

  1. Single bit error In a frame, there is only one bit, anywhere though, which is corrupt.

  2. Multiple bits error Frame is received with more than one bits in corrupted state.

  3. Burst error Frame contains more than1 consecutive bits corrupted.

错误控制机制可能涉及两种可能的方式:

Error control mechanism may involve two possible ways:

  1. Error detection

  2. Error correction

Error Detection

通过奇偶校验和循环冗余校验 (CRC) 检测接收帧中的错误。在这两种情况下,都会发送一些额外的位以及实际数据,以确认在另一端接收到的位与发送的位相同。如果接收端端的反向检查失败,则认为这些位已损坏。

Errors in the received frames are detected by means of Parity Check and Cyclic Redundancy Check (CRC). In both cases, few extra bits are sent along with actual data to confirm that bits received at other end are same as they were sent. If the counter-check at receiver’ end fails, the bits are considered corrupted.

Parity Check

发送一个额外的位以及原始位,以便在偶数奇偶校验的情况下使 1 的数量为偶数,或在奇数奇偶校验的情况下使 1 的数量为奇数。

One extra bit is sent along with the original bits to make number of 1s either even in case of even parity, or odd in case of odd parity.

发送方在创建帧时会计算其中的 1 的数量。例如,如果使用偶数奇偶校验并且 1 的数量为偶数,则添加值为 0 的一位。这样 1 的数量保持偶数。如果 1 的数量为奇数,则需要添加一位,值为 1,使它变为偶数。

The sender while creating a frame counts the number of 1s in it. For example, if even parity is used and number of 1s is even then one bit with value 0 is added. This way number of 1s remains even.If the number of 1s is odd, to make it even a bit with value 1 is added.

even parity

接收方只需计算帧中 1 的数量。如果 1 的数量为偶数并且使用了偶数奇偶校验,则认为该帧未损坏并且可以接受。如果 1 的数量为奇数并且使用了奇数奇偶校验,则该帧仍然未损坏。

The receiver simply counts the number of 1s in a frame. If the count of 1s is even and even parity is used, the frame is considered to be not-corrupted and is accepted. If the count of 1s is odd and odd parity is used, the frame is still not corrupted.

如果在传输过程中某一位发生翻转,接收方可以通过计算 1 的数量来检测到它。但是当多个位有错误时,接收方很难检测到错误。

If a single bit flips in transit, the receiver can detect it by counting the number of 1s. But when more than one bits are erro neous, then it is very hard for the receiver to detect the error.

Cyclic Redundancy Check (CRC)

CRC 是一种不同的方法,用于检测接收到的帧是否包含有效数据。此技术涉及对要发送的数据位进行二进制划分。除数是使用多项式生成的。发送方对要发送的位执行除法运算并计算余数。在发送实际位之前,发送方在实际位的末尾添加余数。实际数据位加上余数称为码字。发送方将数据位传输为码字。

CRC is a different approach to detect if the received frame contains valid data. This technique involves binary division of the data bits being sent. The divisor is generated using polynomials. The sender performs a division operation on the bits being sent and calculates the remainder. Before sending the actual bits, the sender adds the remainder at the end of the actual bits. Actual data bits plus the remainder is called a codeword. The sender transmits data bits as codewords.

crc

在另一端,接收方使用相同的 CRC 除数对码字执行除法运算。如果余数包含所有零,则接受数据位,否则认为在传输过程中发生了一些数据损坏。

At the other end, the receiver performs division operation on codewords using the same CRC divisor. If the remainder contains all zeros the data bits are accepted, otherwise it is considered as there some data corruption occurred in transit.

Error Correction

在数字世界中,错误校正可以通过两种方式完成:

In the digital world, error correction can be done in two ways:

  1. Backward Error Correction  When the receiver detects an error in the data received, it requests back the sender to retransmit the data unit.

  2. Forward Error Correction  When the receiver detects some error in the data received, it executes error-correcting code, which helps it to auto-recover and to correct some kinds of errors.

第一种方法 - 向后错误校正 - 简单且只能在重新传输不昂贵的情况下高效使用。例如,光纤。但在无线传输的情况下,重新传输可能代价太高。在后一种情况下,使用了前向错误校正。

The first one, Backward Error Correction, is simple and can only be efficiently used where retransmitting is not expensive. For example, fiber optics. But in case of wireless transmission retransmitting may cost too much. In the latter case, Forward Error Correction is used.

为了纠正数据帧中的错误,接收器必须确切地知道该帧中的哪个位已损坏。为了找到出错的位,冗余位用作奇偶校验位来进行错误检测。例如,我们采用 ASCII 词(7 位数据),那么我们需要 8 种信息:前 7 位用于告诉我们哪个位出错,再加 1 位表示没有错误。

To correct the error in data frame, the receiver must know exactly which bit in the frame is corrupted. To locate the bit in error, redundant bits are used as parity bits for error detection.For example, we take ASCII words (7 bits data), then there could be 8 kind of information we need: first seven bits to tell us which bit is error and one more bit to tell that there is no error.

对于 m 位数据,使用 r 位冗余位。r 位可以提供 2r 种信息组合。在 m+r 位信息代码中,r 位本身可能会损坏。因此,所用 r 位数必须传达有关 m+r 位位置加上无错误信息,即 m+r+1 的信息。

For m data bits, r redundant bits are used. r bits can provide 2r combinations of information. In m+r bit codeword, there is possibility that the r bits themselves may get corrupted. So the number of r bits used must inform about m+r bit locations plus no-error information, i.e. m+r+1.

required bits

数据链路层负责实现点对点流程和错误控制机制。

Data-link layer is responsible for implementation of point-to-point flow and error control mechanism.

Flow Control

当一个数据帧(第 2 层数据)通过一个介质从一个主机发送到另一个主机时,要求发送方和接收方以相同速度工作。也就是说,发送方以接收方能够处理和接收数据的速度发送数据。如果发送方或接收方的速度(硬件/软件)不同怎么办?如果发送方发送得太快,接收方可能会超载(淹没),数据可能会丢失。

When a data frame (Layer-2 data) is sent from one host to another over a single medium, it is required that the sender and receiver should work at the same speed. That is, sender sends at a speed on which the receiver can process and accept the data. What if the speed (hardware/software) of the sender or receiver differs? If sender is sending too fast the receiver may be overloaded, (swamped) and data may be lost.

可以部署两种类型的机制来控制流:

Two types of mechanisms can be deployed to control the flow:

  1. Stop and Wait

这种流控制机制强制发送方在传输数据帧后停止并等待收到已发送数据帧的确认。

This flow control mechanism forces the sender after transmitting a data frame to stop and wait until the acknowledgement of the data-frame sent is received.

  1. Sliding Window In this flow control mechanism, both sender and receiver agree on the number of data-frames after which the acknowledgement should be sent. As we learnt, stop and wait flow control mechanism wastes resources, this protocol tries to make use of underlying resources as much as possible.

Error Control

当传输数据帧时,数据帧在传输过程中可能会丢失,或者接收到时损坏。在这两种情况下,接收方都不会收到正确的数据帧,并且发送方对任何丢失的情况一无所知。在这种情况下,发送方和接收方都配备了一些协议,帮助他们检测传输错误,例如数据帧丢失。因此,发送方会重新传输数据帧,或者接收方可能会请求重新发送上一个数据帧。

When data-frame is transmitted, there is a probability that data-frame may be lost in the transit or it is received corrupted. In both cases, the receiver does not receive the correct data-frame and sender does not know anything about any loss.In such case, both sender and receiver are equipped with some protocols which helps them to detect transit errors such as loss of data-frame. Hence, either the sender retransmits the data-frame or the receiver may request to resend the previous data-frame.

错误控制机制的要求:

Requirements for error control mechanism:

  1. Error detection  - The sender and receiver, either both or any, must ascertain that there is some error in the transit.

  2. Positive ACK  - When the receiver receives a correct frame, it should acknowledge it.

  3. Negative ACK  - When the receiver receives a damaged frame or a duplicate frame, it sends a NACK back to the sender and the sender must retransmit the correct frame.

  4. Retransmission:  The sender maintains a clock and sets a timeout period. If an acknowledgement of a data-frame previously transmitted does not arrive before the timeout the sender retransmits the frame, thinking that the frame or it’s acknowledgement is lost in transit.

数据链路层可以使用以下三种类型的技术,通过自动重复请求 (ARQ) 来控制错误:

There are three types of techniques available which Data-link layer may deploy to control the errors by Automatic Repeat Requests (ARQ):

  1. 停止等待 ARQ 在停止等待 ARQ 中可能会发生以下转换:发送方维护一个超时计数器。在发送帧时,发送方将启动超时计数器。如果及时收到帧的确认,发送方将传输队列中的下一个帧。如果没有及时收到确认,发送方将假定帧或其确认在传输过程中丢失。发送方将重新传输帧并启动超时计数器。如果收到否定确认,发送方将重新传输帧。

. Stop-and-wait ARQ The following transition may occur in Stop-and-Wait ARQ: The sender maintains a timeout counter.When a frame is sent, the sender starts the timeout counter.If acknowledgement of frame comes in time, the sender transmits the next frame in queue.If acknowledgement does not come in time, the sender assumes that either the frame or its acknowledgement is lost in transit. Sender retransmits the frame and starts the timeout counter.If a negative acknowledgement is received, the sender retransmits the frame.

  1. 回退 N ARQ 停止等待 ARQ 机制无法充分利用资源。收到确认后,发送方将处于空闲状态,无所事事。在回退 N ARQ 方法中,发送方和接收方都将维护一个窗口。发送窗口大小使发送方能够在不接收前一个帧的确认下发送多个帧。接收窗口使接收方能够接收多个帧并确认这些帧。接收方将跟踪传入帧的序列号。当发送方在窗口中发送所有帧后,会检查已收到积极确认的序列号。如果所有帧都已得到积极确认,发送方将发送下一组帧。如果发送方发现已收到 NACK 或没有收到特定帧的任何 ACK,则会重新传输在此之后未收到任何积极 ACK 的所有帧。

. Go-Back-N ARQ Stop and wait ARQ mechanism does not utilize the resources at their best.When the acknowledgement is received, the sender sits idle and does nothing. In Go-Back-N ARQ method, both sender and receiver maintain a window. The sending-window size enables the sender to send multiple frames without receiving the acknowledgement of the previous ones. The receiving-window enables the receiver to receive multiple frames and acknowledge them. The receiver keeps track of incoming frame’s sequence number. When the sender sends all the frames in window, it checks up to what sequence number it has received positive acknowledgement. If all frames are positively acknowledged, the sender sends next set of frames. If sender finds that it has received NACK or has not receive any ACK for a particular frame, it retransmits all the frames after which it does not receive any positive ACK.

  1. 选择性重复 ARQ 在回退 N ARQ 中,假定接收方没有用于其窗口大小的任何缓冲器空间,并且必须在帧到达时处理每个帧。这会强制发送方重新传输未确认的所有帧。在选择性重复 ARQ 中,接收方在跟踪序列号的同时,将帧缓冲在存储器中并仅向丢失或损坏的帧发送 NACK。在这种情况下,发送方仅发送收到 NACK 的数据包。

. Selective Repeat ARQ In Go-back-N ARQ, it is assumed that the receiver does not have any buffer space for its window size and has to process each frame as it comes. This enforces the sender to retransmit all the frames which are not acknowledged. In Selective-Repeat ARQ, the receiver while keeping track of sequence numbers, buffers the frames in memory and sends NACK for only frame which is missing or damaged. The sender in this case, sends only packet for which NACK is received.

Network Layer Introduction

OSI 模型中的第 3 层称为网络层。网络层负责管理与主机和网络寻址、管理子网络和互连网络有关的选项。

Layer-3 in the OSI model is called Network layer. Network layer manages options pertaining to host and network addressing, managing sub-networks, and internetworking.

网络层负责在子网内或子网外将数据包从源路由到目标。两个不同的子网可能具有不同的寻址方案或不兼容的寻址类型。与协议一样,两个不同的子网可能运行不同的协议,而这些协议彼此不兼容。网络层负责将数据包从源路由到目标,映射不同的寻址方案和协议。

Network layer takes the responsibility for routing packets from source to destination within or outside a subnet. Two different subnet may have different addressing schemes or non-compatible addressing types. Same with protocols, two different subnet may be operating on different protocols which are not compatible with each other. Network layer has the responsibility to route the packets from source to destination, mapping different addressing schemes and protocols.

Layer-3 Functionalities

在网络层工作的设备主要专注于路由。路由可能包括旨在实现单个目标的各种任务。这些任务可以是:

Devices which work on Network Layer mainly focus on routing. Routing may include various tasks aimed to achieve a single goal. These can be:

  1. Addressing devices and networks.

  2. Populating routing tables or static routes.

  3. Queuing incoming and outgoing data and then forwarding them according to quality of service constraints set for those packets.

  4. Internetworking between two different subnets.

  5. Delivering packets to destination with best efforts.

  6. Provides connection oriented and connection less mechanism.

Network Layer Features

第 3 层凭借其标准功能可提供各种特性,如:

With its standard functionalities, Layer 3 can provide various features as:

  1. Quality of service management

  2. Load balancing and link management

  3. Security

  4. Interrelation of different protocols and subnets with different schema.

  5. Different logical network design over the physical network design.

  6. L3 VPN and tunnels can be used to provide end to end dedicated connectivity.

互联网协议是广受尊重和部署的网络层协议,它有助于在互联网上实现端到端设备通信。它有两种类型。IPv4 已统治世界数十年,但现在地址空间即将耗尽。IPv6 被创建出来以取代 IPv4,并有望缓解 IPv4 的局限性。

Internet protocol is widely respected and deployed Network Layer protocol which helps to communicate end to end devices over the internet. It comes in two flavors. IPv4 which has ruled the world for decades but now is running out of address space. IPv6 is created to replace IPv4 and hopefully mitigates limitations of IPv4 too.

Network Addressing

第 3 层网络寻址是网络层的主要任务之一。网络地址始终是逻辑的,即这些是可以通过适当配置进行更改的基于软件的地址。

Layer 3 network addressing is one of the major tasks of Network Layer. Network Addresses are always logical i.e. these are software based addresses which can be changed by appropriate configurations.

网络地址始终指向主机/节点/服务器,或者它可以代表整个网络。网络地址始终配置在网络接口卡上,通常由系统通过机器的 MAC 地址(硬件地址或第 2 层地址)进行映射,以用于第 2 层通信。

A network address always points to host / node / server or it can represent a whole network. Network address is always configured on network interface card and is generally mapped by system with the MAC address (hardware address or layer-2 address) of the machine for Layer-2 communication.

现有的网络地址类型多种多样:

There are different kinds of network addresses in existence:

  1. IP

  2. IPX

  3. AppleTalk

我们在这里讨论 IP,因为这是我们如今唯一在实践中使用的地址。

We are discussing IP here as it is the only one we use in practice these days.

network addressing

IP 寻址提供了一种机制来区分主机和网络。由于 IP 地址以分层方式分配,因此主机始终驻留在特定网络之下。需要在其子网外部进行通信的主机需要知道目标网络地址,在那里将发送数据包/数据。

IP addressing provides mechanism to differentiate between hosts and network. Because IP addresses are assigned in hierarchical manner, a host always resides under a specific network.The host which needs to communicate outside its subnet, needs to know destination network address, where the packet/data is to be sent.

不同子网中的主机需要一种机制来互相定位。DNS 可以完成此任务。DNS 是一个提供远程主机第 3 层地址与其域名或 FQDN 映射的服务器。当主机获取远程主机的第 3 层地址(IP 地址)时,它会将其所有数据包转发到其网关。网关是一个配备了所有通向目标主机数据包路由信息的路信息由的路由器。

Hosts in different subnet need a mechanism to locate each other. This task can be done by DNS. DNS is a server which provides Layer-3 address of remote host mapped with its domain name or FQDN. When a host acquires the Layer-3 Address (IP Address) of the remote host, it forwards all its packet to its gateway. A gateway is a router equipped with all the information which leads to route packets to the destination host.

路由器借助路由表,其中包含以下信息:

Routers take help of routing tables, which has the following information:

  1. Method to reach the network

路由器在收到转发请求后,将数据包转发到其向目标的下一跳(相邻路由器)。

Routers upon receiving a forwarding request, forwards packet to its next hop (adjacent router) towards the destination.

路径上的下一个路由器遵循同样的操作,最终数据包到达其目的地。

The next router on the path follows the same thing and eventually the data packet reaches its destination.

网络地址可以是以下几种之一:

Network address can be of one of the following:

  1. Unicast (destined to one host)

  2. Multicast (destined to group)

  3. Broadcast (destined to all)

  4. Anycast (destined to nearest one)

默认情况下路由器从不转发广播流量。多播流量使用特殊处理,因为它是优先级最高的视频流或音频流。任意播与单播类似,但当有多个可用目的地时,数据包会被传递给最近的目的地。

A router never forwards broadcast traffic by default. Multicast traffic uses special treatment as it is most a video stream or audio with highest priority. Anycast is just similar to unicast, except that the packets are delivered to the nearest destination when multiple destinations are available.

Network Layer Routing

当设备访问目标时具有多路径时,会优先选择一条路径。这个选择过程称为路由。路由由特殊网络设备(路由器)完成,也可以通过软件流程完成。基于软件的路由器功能有限,适用范围较小。

When a device has multiple paths to reach a destination, it always selects one path by preferring it over others. This selection process is termed as Routing. Routing is done by special network devices called routers or it can be done by means of software processes.The software based routers have limited functionality and limited scope.

路由器始终配置一些默认路由。默认路由告诉路由器如果没有找到通往特定目的地的路由,则将数据包转发到何处。如果有多条路径可以到达同一目的地,路由器可以根据以下信息做出决策:

A router is always configured with some default route. A default route tells the router where to forward a packet if there is no route found for specific destination. In case there are multiple path existing to reach the same destination, router can make decision based on the following information:

  1. Hop Count

  2. Bandwidth

  3. Metric

  4. Prefix-length

  5. Delay

路由可以通过静态配置或动态学习。可以配置一条路由优先于其他路由。

Routes can be statically configured or dynamically learnt. One route can be configured to be preferred over others.

Unicast routing

互联网和内联网上大多数流量(称为单播数据或单播流量)都使用指定目的地发送。通过互联网路由单播数据称为单播路由。这是最简单的路由形式,因为目的地已知。因此,路由器只需查找路由表并将数据包转发到下一跳即可。

Most of the traffic on the internet and intranets known as unicast data or unicast traffic is sent with specified destination. Routing unicast data over the internet is called unicast routing. It is the simplest form of routing because the destination is already known. Hence the router just has to look up the routing table and forward the packet to next hop.

unicast routing

Broadcast routing

默认情况下,广播数据包不会在任何网络上的路由器路由和转发。路由器创建广播域。但是,可以在某些特殊情况下对其进行配置以转发广播。广播消息会发送给网络中的所有设备。

By default, the broadcast packets are not routed and forwarded by the routers on any network. Routers create broadcast domains. But it can be configured to forward broadcasts in some special cases. A broadcast message is destined to all network devices.

广播路由可以通过两种方式(算法)进行:

Broadcast routing can be done in two ways (algorithm):

  1. A router creates a data packet and then sends it to each host one by one. In this case, the router creates multiple copies of single data packet with different destination addresses. All packets are sent as unicast but because they are sent to all, it simulates as if router is broadcasting. This method consumes lots of bandwidth and router must destination address of each node.

  2. Secondly, when router receives a packet that is to be broadcasted, it simply floods those packets out of all interfaces. All routers are configured in the same way. This method is easy on router’s CPU but may cause the problem of duplicate packets received from peer routers. Reverse path forwarding is a technique, in which router knows in advance about its predecessor from where it should receive broadcast. This technique is used to detect and discard duplicates.

Multicast Routing

多播路由是广播路由的一种特殊情况,具有重要的差异和挑战。在广播路由中,数据包会发送到所有节点,即使它们不需要。但在多播路由中,数据只会发送到希望接收数据包的节点。

Multicast routing is special case of broadcast routing with significance difference and challenges. In broadcast routing, packets are sent to all nodes even if they do not want it. But in Multicast routing, the data is sent to only nodes which wants to receive the packets.

multicast routing

路由器必须知道希望接收多播数据包(或流)的节点,然后才能进行转发。多播路由使用生成树协议来避免循环。

The router must know that there are nodes, which wish to receive multicast packets (or stream) then only it should forward. Multicast routing works spanning tree protocol to avoid looping.

多播路由还使用反向路径转发技术来检测和丢弃重复项和循环。

Multicast routing also uses reverse path Forwarding technique, to detect and discard duplicates and loops.

Anycast Routing

Anycast 数据包转发是一种机制,其中多个主机可以具有相同的逻辑地址。当收到发往此逻辑地址的数据包时,它会发送到在路由拓扑中最近的主机。

Anycast packet forwarding is a mechanism where multiple hosts can have same logical address. When a packet destined to this logical address is received, it is sent to the host which is nearest in routing topology.

Anycast routing

Anycast 路由是借助 DNS 服务器完成的。每当收到 Anycast 数据包时,会询问 DNS 将其发送到何处。DNS 提供的是其上配置的最近的 IP 地址。

Anycast routing is done with help of DNS server. Whenever an Anycast packet is received it is enquired with DNS to where to send it. DNS provides the IP address which is the nearest IP configured on it.

Unicast Routing Protocols

有两种类型的路由协议可用于路由单播数据包:

There are two kinds of routing protocols available to route unicast packets:

距离矢量路由协议距离矢量是一种简单的路由协议,它根据源和目的地之间的跳数进行路由决策。具有较少跳数的路由被认为是最佳路由。每个路由器都会对其最佳路由集通告给其他路由器。最终,所有路由器都会基于对等路由器的通告建立自己的网络拓扑,例如路由信息协议 (RIP)。

. Distance Vector Routing Protocol Distance Vector is simple routing protocol which takes routing decision on the number of hops between source and destination. A route with less number of hops is considered as the best route. Every router advertises its set best routes to other routers. Ultimately, all routers build up their network topology based on the advertisements of their peer routers, For example Routing Information Protocol (RIP).

链路状态路由协议链路状态协议是一种比距离矢量更复杂的协议。它考虑了网络中所有路由器中链路的状态。此技术帮助路由构建整个网络的一个通用图。然后,所有路由器都会计算出其用于路由目的的最佳路径,例如最早打开最短路径 (OSPF) 和中间系统到中间系统 (ISIS)。

. Link State Routing Protocol Link State protocol is slightly complicated protocol than Distance Vector. It takes into account the states of links of all the routers in a network. This technique helps routes build a common graph of the entire network. All routers then calculate their best path for routing purposes.for example, Open Shortest Path First (OSPF) and Intermediate System to Intermediate System (ISIS).

Multicast Routing Protocols

单播路由协议使用图形,而多播路由协议使用树,即生成树来避免循环。最佳树称为最短路径生成树。

Unicast routing protocols use graphs while Multicast routing protocols use trees, i.e. spanning tree to avoid loops. The optimal tree is called shortest path spanning tree.

  1. DVMRP  - Distance Vector Multicast Routing Protocol

  2. MOSPF  - Multicast Open Shortest Path First

  3. CBT  - Core Based Tree

  4. PIM  - Protocol independent Multicast

跨协议组播现在普遍使用。它有两种方式:

Protocol Independent Multicast is commonly used now. It has two flavors:

  1. PIM Dense Mode This mode uses source-based trees. It is used in dense environment such as LAN.

  2. PIM Sparse Mode This mode uses shared trees. It is used in sparse environment such as WAN.

Routing Algorithms

路由算法如下:

The routing algorithms are as follows:

Flooding

泛洪是最简单的分组转发方法。当收到一个数据包时,路由器会将其发送到除收到数据包的接口以外的所有接口。这给网络造成了过大的负担,并且大量重复的数据包在网络中游荡。

Flooding is simplest method packet forwarding. When a packet is received, the routers send it to all the interfaces except the one on which it was received. This creates too much burden on the network and lots of duplicate packets wandering in the network.

使用生存时间 (TTL) 可以避免数据包的无限循环。另一种泛洪方法被称为选择性泛洪,它可以减少网络开销。在此方法中,路由器不会泛洪到所有接口,而是选择性地泛洪。

Time to Live (TTL) can be used to avoid infinite looping of packets. There exists another approach for flooding, which is called Selective Flooding to reduce the overhead on the network. In this method, the router does not flood out on all the interfaces, but selective ones.

Shortest Path

网络中的路由决策主要基于源和目标之间的成本。跳数在这里起着主要作用。最短路径是一种使用各种算法来决定具有最少跳数的路径的技术。

Routing decision in networks, are mostly taken on the basis of cost between source and destination. Hop count plays major role here. Shortest path is a technique which uses various algorithms to decide a path with minimum number of hops.

常见的最短路径算法有:

Common shortest path algorithms are:

  1. Dijkstra’s algorithm

  2. Bellman Ford algorithm

  3. Floyd Warshall algorithm

Internetworking

在实际情况下,处于同一管理下的网络通常在地理上分散。可能存在将相同类型的两个不同网络以及不同类型的两个不同网络连接起来的需求。两个网络之间的路由被称为互联网络。

In real world scenario, networks under same administration are generally scattered geographically. There may exist requirement of connecting two different networks of same kind as well as of different kinds. Routing between two networks is called internetworking.

可以根据各种参数(例如,协议、拓扑、第 2 层网络和寻址方案)将网络视为不同。

Networks can be considered different based on various parameters such as, Protocol, topology, Layer-2 network and addressing scheme.

在互联网络中,路由器相互了解对方的地址以及超出它们的其他地址。它们可以被静态地配置到不同的网络上,也可以通过使用互联网络路由协议进行学习。

In internetworking, routers have knowledge of each other’s address and addresses beyond them. They can be statically configured go on different network or they can learn by using internetworking routing protocol.

routing

在组织或管理中使用的路由协议称为内部网关协议或 IGP。RIP、OSPF 是 IGP 的示例。不同组织或管理之间的路由可能具有外部网关协议,并且只有一种 EGP,即边界网关协议。

Routing protocols which are used within an organization or administration are called Interior Gateway Protocols or IGP. RIP, OSPF are examples of IGP. Routing between different organizations or administrations may have Exterior Gateway Protocol, and there is only one EGP i.e. Border Gateway Protocol.

Tunneling

如果两个在地理上分离的网络想要相互通信,它们可以在它们之间部署一条专线,或者它们必须通过中间网络传输数据。

If they are two geographically separate networks, which want to communicate with each other, they may deploy a dedicated line between or they have to pass their data through intermediate networks.

隧道是一种机制,两个或更多相同的网络通过传递中间网络复杂性相互通信。隧道配置在两端。

Tunneling is a mechanism by which two or more same networks communicate with each other, by passing intermediate networking complexities. Tunneling is configured at both ends.

tunneling

当数据从隧道的其中一端输入时,它被标记。然后将此标记数据在中间或中转网络内路由到隧道的另一端。当数据退出隧道时,其标记将被移除并传递到网络的另一部分。

When the data enters from one end of Tunnel, it is tagged. This tagged data is then routed inside the intermediate or transit network to reach the other end of Tunnel. When data exists the Tunnel its tag is removed and delivered to the other part of the network.

两端似乎直接连接,并且标记使数据在中转网络中传输而不会进行任何修改。

Both ends seem as if they are directly connected and tagging makes data travel through transit network without any modifications.

Packet Fragmentation

大多数以太网段的最大传输单元 (MTU) 固定为 1500 字节。数据包的长度可以根据应用程序而多或少。中转路径中的设备还具有硬件和软件功能,这些功能指示该设备可以处理多少数据以及可以处理多大的数据包。

Most Ethernet segments have their maximum transmission unit (MTU) fixed to 1500 bytes. A data packet can have more or less packet length depending upon the application. Devices in the transit path also have their hardware and software capabilities which tell what amount of data that device can handle and what size of packet it can process.

如果数据包大小小于或等于中转网络可以处理的数据包大小,则该数据包以中立的方式进行处理。如果数据包较大,则将其分解为较小的片段,然后转发。这称为数据包分段。每个片段包含相同的目标和源地址,并且很容易通过中转路径路由。在接收端将其再次组装。

If the data packet size is less than or equal to the size of packet the transit network can handle, it is processed neutrally. If the packet is larger, it is broken into smaller pieces and then forwarded. This is called packet fragmentation. Each fragment contains the same destination and source address and routed through transit path easily. At the receiving end it is assembled again.

如果带有 DF(请勿分段)比特设置设为 1 的数据包到达因其长度而无法处理该数据包的路由器,则丢弃该数据包。

If a packet with DF (don’t fragment) bit set to 1 comes to a router which can not handle the packet because of its length, the packet is dropped.

当路由器收到 MF(更多片段)比特设为 1 的数据包时,路由器知道这是一个分段数据包,原始数据包的部分正在传送中。

When a packet is received by a router has its MF (more fragments) bit set to 1, the router then knows that it is a fragmented packet and parts of the original packet is on the way.

如果数据包分段太小,则会增加开销。如果数据包分段太大,则中间路由器可能无法处理它,并且可能会被丢弃。

If packet is fragmented too small, the overhead is increases. If the packet is fragmented too large, intermediate router may not be able to process it and it might get dropped.

Network Layer Protocols

网络中的每台计算机都有一个 IP 地址,可通过该地址对其进行唯一标识和寻址。IP 地址是第 3 层(网络层)的逻辑地址。此地址在每次计算机重启时都可能更改。计算机在某一时间可以有一个 IP,在另一时间可以有另一个 IP。

Every computer in a network has an IP address by which it can be uniquely identified and addressed. An IP address is Layer-3 (Network Layer) logical address. This address may change every time a computer restarts. A computer can have one IP at one instance of time and another IP at some different time.

Address Resolution Protocol(ARP)

在通信时,主机需要属于同一广播域或网络的目的地计算机的第 2 层(MAC)地址。MAC 地址物理刻录在计算机的网络接口卡 (NIC) 中,并且永远不会更改。

While communicating, a host needs Layer-2 (MAC) address of the destination machine which belongs to the same broadcast domain or network. A MAC address is physically burnt into the Network Interface Card (NIC) of a machine and it never changes.

另一方面,公有域的 IP 地址很少更改。如果在出现某些故障的情况下更换了网卡,MAC 地址也会更改。这样,为了进行第 2 层通信,需要对两者进行映射。

On the other hand, IP address on the public domain is rarely changed. If the NIC is changed in case of some fault, the MAC address also changes. This way, for Layer-2 communication to take place, a mapping between the two is required.

arp

为了得知广播域中远程主机的 MAC 地址,希望启动通信的计算机发送一个 ARP 广播消息,询问“谁拥有这个 IP 地址?”由于是广播,网络段(广播域)上的所有主机都会接收并处理此数据包。ARP 数据包包含目标主机的 IP 地址,发送主机希望与此主机通信。当一台主机收到发往自己的 ARP 数据包时,它会用自己的 MAC 地址回复。

To know the MAC address of remote host on a broadcast domain, a computer wishing to initiate communication sends out an ARP broadcast message asking, “Who has this IP address?” Because it is a broadcast, all hosts on the network segment (broadcast domain) receive this packet and process it. ARP packet contains the IP address of destination host, the sending host wishes to talk to. When a host receives an ARP packet destined to it, it replies back with its own MAC address.

一旦主机获取了目标 MAC 地址,它就可以使用第 2 层链路协议与远程主机通信。此 MAC 到 IP 的映射将保存到发送和接收主机的 ARP 缓存中。下次如果需要通信,它们可以直接引用各自的 ARP 缓存。

Once the host gets destination MAC address, it can communicate with remote host using Layer-2 link protocol. This MAC to IP mapping is saved into ARP cache of both sending and receiving hosts. Next time, if they require to communicate, they can directly refer to their respective ARP cache.

反向 ARP 是一种机制,其中主机知道远程主机的 MAC 地址,但需要知道 IP 地址才能进行通信。

Reverse ARP is a mechanism where host knows the MAC address of remote host but requires to know IP address to communicate.

Internet Control Message Protocol (ICMP)

ICMP 是一种网络诊断和错误报告协议。ICMP 属于 IP 协议套件,并使用 IP 作为载波协议。在构造 ICMP 数据包后,它会封装在 IP 数据包中。因为 IP 本身就是一种尽力而为的不可靠协议,所以 ICMP 也是如此。

ICMP is network diagnostic and error reporting protocol. ICMP belongs to IP protocol suite and uses IP as carrier protocol. After constructing ICMP packet, it is encapsulated in IP packet. Because IP itself is a best-effort non-reliable protocol, so is ICMP.

任何有关网络的反馈都将发回源主机。如果网络中发生某些错误,将通过 ICMP 报告。ICMP 包含数十个诊断和错误报告消息。

Any feedback about network is sent back to the originating host. If some error in the network occurs, it is reported by means of ICMP. ICMP contains dozens of diagnostic and error reporting messages.

ICMP-echo 和 ICMP-echo-reply 是最常用的 ICMP 消息,用于检查端到端主机的可达性。当主机收到 ICMP-echo 请求时,它会向回发送 ICMP-echo-reply。如果中转网络中出现任何问题,ICMP 都会报告该问题。

ICMP-echo and ICMP-echo-reply are the most commonly used ICMP messages to check the reachability of end-to-end hosts. When a host receives an ICMP-echo request, it is bound to send back an ICMP-echo-reply. If there is any problem in the transit network, the ICMP will report that problem.

Internet Protocol Version 4 (IPv4)

IPv4 是用作 TCP/IP 主机寻址机制的 32 位寻址方案。IP 寻址使 TCP/IP 网络上的每个主机都可以唯一标识。

IPv4 is 32-bit addressing scheme used as TCP/IP host addressing mechanism. IP addressing enables every host on the TCP/IP network to be uniquely identifiable.

IPv4 提供了分层寻址方案,可以将其网络划分为子网络,每个子网络都有明确定义的主机数量。IP 地址分为许多类别:

IPv4 provides hierarchical addressing scheme which enables it to divide the network into sub-networks, each with well-defined number of hosts. IP addresses are divided into many categories:

  1. Class A  - it uses first octet for network addresses and last three octets for host addressing

  2. Class B  - it uses first two octets for network addresses and last two for host addressing

  3. Class C  - it uses first three octets for network addresses and last one for host addressing

  4. Class D  - it provides flat IP addressing scheme in contrast to hierarchical structure for above three.

  5. Class E  - It is used as experimental.

IPv4 还拥有明确定义的地址空间,可作为私有地址(无法在互联网上路由)和公共地址(由 ISP 提供并可以在互联网上路由)使用。

IPv4 also has well-defined address spaces to be used as private addresses (not routable on internet), and public addresses (provided by ISPs and are routable on internet).

虽然 IP 不是可靠的,但它提供了“尽力而为的交付”机制。

Though IP is not reliable one; it provides ‘Best-Effort-Delivery’ mechanism.

Internet Protocol Version 6 (IPv6)

IPv4 地址枯竭催生了下一代互联网协议版本 6。IPv6 使用 128 位宽地址对节点进行寻址,为未来在整个地球或更远的地方使用提供了充足的地址空间。

Exhaustion of IPv4 addresses gave birth to a next generation Internet Protocol version 6. IPv6 addresses its nodes with 128-bit wide address providing plenty of address space for future to be used on entire planet or beyond.

IPv6 引入了 Anycast 地址指定,但去掉了广播概念。IPv6 使设备能够自动获取 IPv6 地址并在子网内通信。这种自动配置消除了对动态主机配置协议 (DHCP) 服务器的依赖。这样一来,即使该子网上的 DHCP 服务器宕机,主机也能相互通信。

IPv6 has introduced Anycast addressing but has removed the concept of broadcasting. IPv6 enables devices to self-acquire an IPv6 address and communicate within that subnet. This auto-configuration removes the dependability of Dynamic Host Configuration Protocol (DHCP) servers. This way, even if the DHCP server on that subnet is down, the hosts can communicate with each other.

IPv6 提供了 IPv6 移动性这一新特性。具备移动 IPv6 的机器可以在无需更改其 IP 地址的情况下漫游。

IPv6 provides new feature of IPv6 mobility. Mobile IPv6 equipped machines can roam around without the need of changing their IP addresses.

IPv6 仍处于过渡阶段,预计在未来几年将完全取代 IPv4。目前,只有少数网络在运行 IPv6。有一些过渡机制可用于使启用了 IPv6 的网络在 IPv4 上轻松地相互通信和漫游。这些机制包括:

IPv6 is still in transition phase and is expected to replace IPv4 completely in coming years. At present, there are few networks which are running on IPv6. There are some transition mechanisms available for IPv6 enabled networks to speak and roam around different networks easily on IPv4. These are:

  1. Dual stack implementation

  2. Tunneling

  3. NAT-PT

Transport Layer Introduction

OSI 模型中的下一层被识别为传输层(层 4)。与数据或数据流传输有关的所有模块和程序都归为此层。与所有其他层一样,此层与其远程主机的对等传输层通信。

Next Layer in OSI Model is recognized as Transport Layer (Layer-4). All modules and procedures pertaining to transportation of data or data stream are categorized into this layer. As all other layers, this layer communicates with its peer Transport layer of the remote host.

传输层提供远程主机上两个进程之间的点对点和端到端连接。传输层从上层(即应用程序层)获取数据,然后将其分解为较小的段,对每个字节进行编号,并交给下层(网络层)进行传递。

Transport layer offers peer-to-peer and end-to-end connection between two processes on remote hosts. Transport layer takes data from upper layer (i.e. Application layer) and then breaks it into smaller size segments, numbers each byte, and hands over to lower layer (Network Layer) for delivery.

Functions

  1. This Layer is the first one which breaks the information data, supplied by Application layer in to smaller units called segments. It numbers every byte in the segment and maintains their accounting.

  2. This layer ensures that data must be received in the same sequence in which it was sent.

  3. This layer provides end-to-end delivery of data between hosts which may or may not belong to the same subnet.

  4. All server processes intend to communicate over the network are equipped with well-known Transport Service Access Points (TSAPs) also known as port numbers.

End-to-End Communication

一个主机上的进程通过 TSAP(也称为端口号)识别远程网络上的对等主机。TSAP 定义非常明确,尝试与对等主机通信的进程会预先知道这一点。

A process on one host identifies its peer host on remote network by means of TSAPs, also known as Port numbers. TSAPs are very well defined and a process which is trying to communicate with its peer knows this in advance.

TSAP

例如,当 DHCP 客户端想要与远程 DHCP 服务器通信时,它总是请求端口号 67。当 DNS 客户端想要与远程 DNS 服务器通信时,它总是请求端口号 53(UDP)。

For example, when a DHCP client wants to communicate with remote DHCP server, it always requests on port number 67. When a DNS client wants to communicate with remote DNS server, it always requests on port number 53 (UDP).

两个主要的传输层协议是:

The two main Transport layer protocols are:

  1. Transmission Control Protocol It provides reliable communication between two hosts.

  2. User Datagram Protocol It provides unreliable communication between two hosts.

Transmission Control Protocol

传输控制协议 (TCP) 是互联网协议套件中最重要的协议之一。它是通信网络(如互联网)中用于数据传输的最广泛使用的协议。

The transmission Control Protocol (TCP) is one of the most important protocols of Internet Protocols suite. It is most widely used protocol for data transmission in communication network such as internet.

Features

  1. TCP is reliable protocol. That is, the receiver always sends either positive or negative acknowledgement about the data packet to the sender, so that the sender always has bright clue about whether the data packet is reached the destination or it needs to resend it.

  2. TCP ensures that the data reaches intended destination in the same order it was sent.

  3. TCP is connection oriented. TCP requires that connection between two remote points be established before sending actual data.

  4. TCP provides error-checking and recovery mechanism.

  5. TCP provides end-to-end communication.

  6. TCP provides flow control and quality of service.

  7. TCP operates in Client/Server point-to-point mode.

  8. TCP provides full duplex server, i.e. it can perform roles of both receiver and sender.

Header

TCP 报头的长度最少为 20 字节,最长为 60 字节。

The length of TCP header is minimum 20 bytes long and maximum 60 bytes.

TCP Header
  1. Source Port (16-bits)  - It identifies source port of the application process on the sending device.

  2. Destination Port (16-bits) - It identifies destination port of the application process on the receiving device.

  3. Sequence Number (32-bits) - Sequence number of data bytes of a segment in a session.

  4. Acknowledgement Number (32-bits)  - When ACK flag is set, this number contains the next sequence number of the data byte expected and works as acknowledgement of the previous data received.

  5. Data Offset (4-bits)  - This field implies both, the size of TCP header (32-bit words) and the offset of data in current packet in the whole TCP segment.

  6. Reserved (3-bits)  - Reserved for future use and all are set zero by default.

  7. Flags (1-bit each)

NS - 随机数和位由显式拥塞通知信令进程使用。 CWR - 当主机收到带有 ECE 比特位的报文时,它会设置拥塞窗口减小,以确认已收到 ECE。 ECE - 它具有两个含义:如果 SYN 比特位清除为 0,那么 ECE 表示 IP 数据包设置了其 CE(拥塞体验)比特位。如果 SYN 比特位设置为 1,则 ECE 表示该设备具有 ECT 功能。 URG - 它表明紧急指针字段具有重要数据,应予以处理。 ACK - 它表明确认字段具有重要意义。如果 ACK 被清除为 0,它表示数据包不包含任何确认。 PSH - 设置时,它是向接收站发出请求,要求将其(只要一到达)推送(push)到接收应用程序,而不要对其进行缓冲。 RST - 重置标志具有以下特点:它用于拒绝传入连接。它用于拒绝报文分段。它用于重启连接。 SYN - 此标志用于在主机之间建立连接。 FIN - 此标志用于释放连接,此后不再交换数据。由于具有 SYN 和 FIN 标志的数据包具有序号,因此将按正确顺序对其进行处理。

NS - Nonce Sum bit is used by Explicit Congestion Notification signaling process. CWR - When a host receives packet with ECE bit set, it sets Congestion Windows Reduced to acknowledge that ECE received. ECE -It has two meanings: If SYN bit is clear to 0, then ECE means that the IP packet has its CE (congestion experience) bit set. If SYN bit is set to 1, ECE means that the device is ECT capable. URG - It indicates that Urgent Pointer field has significant data and should be processed. ACK - It indicates that Acknowledgement field has significance. If ACK is cleared to 0, it indicates that packet does not contain any acknowledgement. PSH - When set, it is a request to the receiving station to PUSH data (as soon as it comes) to the receiving application without buffering it. RST - Reset flag has the following features: It is used to refuse an incoming connection. It is used to reject a segment. It is used to restart a connection. SYN - This flag is used to set up a connection between hosts. FIN - This flag is used to release a connection and no more data is exchanged thereafter. Because packets with SYN and FIN flags have sequence numbers, they are processed in correct order.

  1. Windows Size  - This field is used for flow control between two stations and indicates the amount of buffer (in bytes) the receiver has allocated for a segment, i.e. how much data is the receiver expecting.

  2. Checksum - This field contains the checksum of Header, Data and Pseudo Headers.

  3. Urgent Pointer  - It points to the urgent data byte if URG flag is set to 1.

  4. Options  - It facilitates additional options which are not covered by the regular header. Option field is always described in 32-bit words. If this field contains data less than 32-bit, padding is used to cover the remaining bits to reach 32-bit boundary.

Addressing

两个远程主机之间的 TCP 通信是通过端口号(TSAP)完成的。端口号的范围是 0 到 65535,分为:

TCP communication between two remote hosts is done by means of port numbers (TSAPs). Ports numbers can range from 0 – 65535 which are divided as:

  1. System Ports (0 – 1023)

  2. User Ports ( 1024 – 49151)

  3. Private/Dynamic Ports (49152 – 65535)

Connection Management

TCP 通信以服务器/客户端模式工作。客户端发起连接,服务器要么接受要么拒绝连接。使用三向握手来进行连接管理。

TCP communication works in Server/Client model. The client initiates the connection and the server either accepts or rejects it. Three-way handshaking is used for connection management.

TCP handshake

Establishment

客户端发起连接并发送带有序号的报文分段。服务器用自己的序号对其进行确认,并对客户端的报文分段进行 ACK,其值比客户端的序号大 1。客户端在收到其报文分段的 ACK 后,对服务器的响应发送确认。

Client initiates the connection and sends the segment with a Sequence number. Server acknowledges it back with its own Sequence number and ACK of client’s segment which is one more than client’s Sequence number. Client after receiving ACK of its segment sends an acknowledgement of Server’s response.

Release

服务器和客户端都可以发送设置 FIN 标志为 1 的 TCP 报文分段。当接收端通过确认 FIN 来对其进行响应时,该方向的 TCP 通信即关闭,并且连接被释放。

Either of server and client can send TCP segment with FIN flag set to 1. When the receiving end responds it back by ACKnowledging FIN, that direction of TCP communication is closed and connection is released.

Bandwidth Management

TCP 使用窗口大小的概念来满足带宽管理的需求。窗口大小告知远程端的发送方,此端接收方可以接收的数据字节段数。TCP 使用窗口大小 1 通过慢启动阶段,并在每次成功通信后以指数方式增加窗口大小。

TCP uses the concept of window size to accommodate the need of Bandwidth management. Window size tells the sender at the remote end, the number of data byte segments the receiver at this end can receive. TCP uses slow start phase by using window size 1 and increases the window size exponentially after each successful communication.

例如,客户端使用窗口大小 2,并发送 2 个字节的数据。当收到此段的确认时,窗口大小会加倍为 4,而下一次发送的段长度将为 4 个数据字节。当收到 4 字节数据段的确认后,客户端将窗口大小设置为 8,依此类推。

For example, the client uses windows size 2 and sends 2 bytes of data. When the acknowledgement of this segment received the windows size is doubled to 4 and next sent the segment sent will be 4 data bytes long. When the acknowledgement of 4-byte data segment is received, the client sets windows size to 8 and so on.

如果错失确认(即数据在传输网络中丢失或收到 NACK),则窗口大小将减半,并重新启动慢启动阶段。

If an acknowledgement is missed, i.e. data lost in transit network or it received NACK, then the window size is reduced to half and slow start phase starts again.

Error Control &and Flow Control

TCP 使用端口号来了解它需要将数据段移交到哪个应用程序进程。除此之外,它还使用序列号来与远程主机同步。所有数据段都带有序列号进行发送和接收。发送方通过获得 ACK 时,了解接收方收到的上一个数据段是什么。接收方通过查阅最近收到的数据包的序列号而了解发送方发送的上一个数据段。

TCP uses port numbers to know what application process it needs to handover the data segment. Along with that, it uses sequence numbers to synchronize itself with the remote host. All data segments are sent and received with sequence numbers. The Sender knows which last data segment was received by the Receiver when it gets ACK. The Receiver knows about the last segment sent by the Sender by referring to the sequence number of recently received packet.

如果最近收到的数据段的序列号与接收方预期的序列号不匹配,则该段将被丢弃,并发送回 NACK。如果两个段带有相同的序列号到达,则将比较 TCP 时间戳值以做出决策。

If the sequence number of a segment recently received does not match with the sequence number the receiver was expecting, then it is discarded and NACK is sent back. If two segments arrive with the same sequence number, the TCP timestamp value is compared to make a decision.

Multiplexing

将两个或多个数据流合并到一个会话中的技术称为多路复用。当 TCP 客户端与服务器初始化连接时,它始终会指代一个明确的端口号,该端口号表示该应用程序进程。客户端本身使用从专用端口号池中随机生成的端口号。

The technique to combine two or more data streams in one session is called Multiplexing. When a TCP client initializes a connection with Server, it always refers to a well-defined port number which indicates the application process. The client itself uses a randomly generated port number from private port number pools.

通过使用 TCP 多路复用,一个客户端可以在单个会话中与多个不同的应用程序进程通信。例如,客户端请求一个网页,该网页包含不同类型的数据(HTTP、SMTP、FTP 等),TCP 会话超时被增加,会话将被保持开放更长时间,从而可以避免三路握手开销。

Using TCP Multiplexing, a client can communicate with a number of different application process in a single session. For example, a client requests a web page which in turn contains different types of data (HTTP, SMTP, FTP etc.) the TCP session timeout is increased and the session is kept open for longer time so that the three-way handshake overhead can be avoided.

这使用户系统能够通过单个虚拟连接接收多个连接。如果超时时间太长,这些虚拟连接并不适用于服务器。

This enables the client system to receive multiple connection over single virtual connection. These virtual connections are not good for Servers if the timeout is too long.

Congestion Control

当系统中输入大量的数据而系统无法处理时,就会发生拥塞。TCP 通过窗口机制来控制拥塞。TCP 设置窗口大小,告诉另一端发送多少数据段。TCP 可使用三种算法来控制拥塞:

When large amount of data is fed to system which is not capable of handling it, congestion occurs. TCP controls congestion by means of Window mechanism. TCP sets a window size telling the other end how much data segment to send. TCP may use three algorithms for congestion control:

  1. Additive increase, Multiplicative Decrease

  2. Slow Start

  3. Timeout React

Timer Management

TCP 使用不同类型的计时器来控制和管理各种任务:

TCP uses different types of timer to control and management various tasks:

Keep-alive timer:

  1. This timer is used to check the integrity and validity of a connection.

  2. When keep-alive time expires, the host sends a probe to check if the connection still exists.

Retransmission timer:

  1. This timer maintains stateful session of data sent.

  2. If the acknowledgement of sent data does not receive within the Retransmission time, the data segment is sent again.

Persist timer:

  1. TCP session can be paused by either host by sending Window Size 0.

  2. To resume the session a host needs to send Window Size with some larger value.

  3. If this segment never reaches the other end, both ends may wait for each other for infinite time.

  4. When the Persist timer expires, the host re-sends its window size to let the other end know.

  5. Persist Timer helps avoid deadlocks in communication.

Timed-Wait:

  1. After releasing a connection, either of the hosts waits for a Timed-Wait time to terminate the connection completely.

  2. This is in order to make sure that the other end has received the acknowledgement of its connection termination request.

  3. Timed-out can be a maximum of 240 seconds (4 minutes).

Crash Recovery

TCP 是一个非常可靠的协议。它为每个段中发送的字节提供序列号。它提供反馈机制,即当主机收到一个数据包时,它有义务对具有下一期望序列号(如果不是最后一个段)的数据包发送 ACK。

TCP is very reliable protocol. It provides sequence number to each of byte sent in segment. It provides the feedback mechanism i.e. when a host receives a packet, it is bound to ACK that packet having the next sequence number expected (if it is not the last segment).

当一个 TCP 服务器在通信途中崩溃并重新开始其进程时,它会向其所有主机发送 TPDU 广播。然后,主机可以发送从未确认且带有的最后一个数据段继续接收。

When a TCP Server crashes mid-way communication and re-starts its process it sends TPDU broadcast to all its hosts. The hosts can then send the last data segment which was never unacknowledged and carry onwards.

User Datagram Protocol

用户数据报协议(UDP)是 TCP/IP 协议套件中提供最简单的传输层通信协议。它包含最少的通信机制。UDP 被称为不可靠的传输协议,但它使用 IP 服务,提供尽力而为的传输机制。

The User Datagram Protocol (UDP) is simplest Transport Layer communication protocol available of the TCP/IP protocol suite. It involves minimum amount of communication mechanism. UDP is said to be an unreliable transport protocol but it uses IP services which provides best effort delivery mechanism.

在 UDP 中,接收方不会产生收到的数据包的确认,反过来,发送方不会等待所发送数据包的任何确认。这个缺点使此协议不可靠,并且更易于处理。

In UDP, the receiver does not generate an acknowledgement of packet received and in turn, the sender does not wait for any acknowledgement of packet sent. This shortcoming makes this protocol unreliable as well as easier on processing.

Requirement of UDP

可能会出现一个问题,为什么我们需要一个不可靠的协议来传输数据?我们在确认数据包与实际数据一起共享大量带宽的情况下部署 UDP。例如,在视频流的情况下,数千个数据包会转发给其用户。对所有数据包进行确认会很麻烦,并且可能会造成大量的带宽浪费。底层 IP 协议的最佳传输机制确保尽力传输其数据包,但即使视频流中丢失了一些数据包,影响也不大并且可以轻松忽略。有时,视频和语音流量中丢包会悄无声息。

A question may arise, why do we need an unreliable protocol to transport the data? We deploy UDP where the acknowledgement packets share significant amount of bandwidth along with the actual data. For example, in case of video streaming, thousands of packets are forwarded towards its users. Acknowledging all the packets is troublesome and may contain huge amount of bandwidth wastage. The best delivery mechanism of underlying IP protocol ensures best efforts to deliver its packets, but even if some packets in video streaming get lost, the impact is not calamitous and can be ignored easily. Loss of few packets in video and voice traffic sometimes goes unnoticed.

Features

  1. UDP is used when acknowledgement of data does not hold any significance.

  2. UDP is good protocol for data flowing in one direction.

  3. UDP is simple and suitable for query based communications.

  4. UDP is not connection oriented.

  5. UDP does not provide congestion control mechanism.

  6. UDP does not guarantee ordered delivery of data.

  7. UDP is stateless.

  8. UDP is suitable protocol for streaming applications such as VoIP, multimedia streaming.

UDP Header

UDP 报头与它的功能一样简单。

UDP header is as simple as its function.

UDP Header

UDP 报头包含四个主要参数:

UDP header contains four main parameters:

  1. Source Port  - This 16 bits information is used to identify the source port of the packet.

  2. Destination Port  - This 16 bits information, is used identify application level service on destination machine.

  3. Length  - Length field specifies the entire length of UDP packet (including header). It is 16-bits field and minimum value is 8-byte, i.e. the size of UDP header itself.

  4. Checksum  - This field stores the checksum value generated by the sender before sending. IPv4 has this field as optional so when checksum field does not contain any value it is made 0 and all its bits are set to zero.

UDP application

以下是使用 UDP 传输数据的几个应用程序:

Here are few applications where UDP is used to transmit data:

  1. Domain Name Services

  2. Simple Network Management Protocol

  3. Trivial File Transfer Protocol

  4. Routing Information Protocol

  5. Kerberos

Application Layer Introduction

应用程序层是 OSI 和 TCP/IP 分层模型中最顶层。由于应用程序层与用户和用户应用程序交互非常重要,因此在两个分层模型中都存在此层。此层适用于参与通信系统的应用程序。

Application layer is the top most layer in OSI and TCP/IP layered model. This layer exists in both layered Models because of its significance, of interacting with user and user applications. This layer is for applications which are involved in communication system.

用户可能直接或不直接与应用程序交互。应用程序层是实际通信发起和反射的位置。因为此层位于层堆栈的顶部,所以它不向任何其他层提供服务。应用程序层借助传输层和所有其下层来向远程主机通信或传输其数据。

A user may or may not directly interacts with the applications. Application layer is where the actual communication is initiated and reflects. Because this layer is on the top of the layer stack, it does not serve any other layers. Application layer takes the help of Transport and all layers below it to communicate or transfer its data to the remote host.

当应用程序层协议想要与其在远程主机上的对等应用程序层协议通信时,它会将数据或信息传递给传输层。传输层借助下层的所有层完成其余工作。

When an application layer protocol wants to communicate with its peer application layer protocol on remote host, it hands over the data or information to the Transport layer. The transport layer does the rest with the help of all the layers below it.

application layer

在理解应用程序层及其协议时存在歧义。并非每个用户应用程序都可以放入应用程序层。除了与通信系统交互的应用程序外。例如,设计软件或文本编辑器不能被视为应用程序层程序。

There’is an ambiguity in understanding Application Layer and its protocol. Not every user application can be put into Application Layer. except those applications which interact with the communication system. For example, designing software or text-editor cannot be considered as application layer programs.

另一方面,当我们使用 Web 浏览器时,它实际上使用超文本传输协议 (HTTP) 与网络进行交互。HTTP 是应用程序层协议。

On the other hand, when we use a Web Browser, which is actually using Hyper Text Transfer Protocol (HTTP) to interact with the network. HTTP is Application Layer protocol.

另一个示例是文件传输协议,它帮助用户在网络中传输基于文本或二进制的文件。用户可以在基于 GUI 的软件(如 FileZilla 或 CuteFTP)中使用此协议,并且同一用户可以在命令行模式中使用 FTP。

Another example is File Transfer Protocol, which helps a user to transfer text based or binary files across the network. A user can use this protocol in either GUI based software like FileZilla or CuteFTP and the same user can use FTP in Command Line mode.

因此,无论您使用哪种软件,该软件使用的应用程序层中的协议都被考虑在内。DNS 是一个协议,它帮助用户应用程序协议(如 HTTP)完成其工作。

Hence, irrespective of which software you use, it is the protocol which is considered at Application Layer used by that software. DNS is a protocol which helps user application protocols such as HTTP to accomplish its work.

Client Server Model

两个远程应用程序进程主要可以使用两种不同的方式进行通信:

Two remote application processes can communicate mainly in two different fashions:

  1. Peer-to-peer: Both remote processes are executing at same level and they exchange data using some shared resource.

  2. Client-Server: One remote process acts as a Client and requests some resource from another application process acting as Server.

在客户机-服务器模型中,任何进程都可以充当服务器或客户机。它并不是机器的类型、机器的大小或计算能力使其成为服务器;而是提供服务的这一能力使一台机器成为服务器。

In client-server model, any process can act as Server or Client. It is not the type of machine, size of the machine, or its computing power which makes it server; it is the ability of serving request that makes a machine a server.

client server

系统可以同时作为服务器和客户机。也就是说,一个进程充当服务器,另一个进程充当客户机。客户端和服务器进程都有可能驻留在同一台机器上。

A system can act as Server and Client simultaneously. That is, one process is acting as Server and another is acting as a client. This may also happen that both client and server processes reside on the same machine.

Communication

客户机-服务器模型中的两个进程可以通过多种方式进行交互:

Two processes in client-server model can interact in various ways:

  1. Sockets

  2. Remote Procedure Calls (RPC)

Sockets

在这种模式中,充当服务器的进程使用一个众所周知的(或客户机已知的)端口打开一个套接字,并等待客户端请求到来。充当客户机的第二个进程也打开一个套接字,但它不是等待传入请求,而是“先请求”。

In this paradigm, the process acting as Server opens a socket using a well-known (or known by client) port and waits until some client request comes. The second process acting as a Client also opens a socket but instead of waiting for an incoming request, the client processes ‘requests first’.

sockets

当服务器收到请求时,它会予以处理。它既可以是信息共享,也可以是资源请求。

When the request is reached to server, it is served. It can either be an information sharing or resource request.

Remote Procedure Call

这是一个进程通过执行过程调用与另一个进程进行交互的机制。一个进程(客户机)调用远程主机上的过程。远程主机上的进程被称为服务器。两个进程都被分配了存根。这种通信以以下方式发生:

This is a mechanism where one process interacts with another by means of procedure calls. One process (client) calls the procedure lying on remote host. The process on remote host is said to be Server. Both processes are allocated stubs. This communication happens in the following way:

  1. The client process calls the client stub. It passes all the parameters pertaining to program local to it.

  2. All parameters are then packed (marshalled) and a system call is made to send them to other side of the network.

  3. Kernel sends the data over the network and the other end receives it.

  4. The remote host passes data to the server stub where it is unmarshalled.

  5. The parameters are passed to the procedure and the procedure is then executed.

  6. The result is sent back to the client in the same manner.

Application Protocols

用户在应用层有多种协议可用。应用层协议可以大致分为两类:

There are several protocols which work for users in Application Layer. Application layer protocols can be broadly divided into two categories:

  1. Protocols which are used by users.For email for example, eMail.

  2. Protocols which help and support protocols used by users.For example DNS.

下面描述了应用层中的一些协议:

Few of Application layer protocols are described below:

Domain Name System

域名系统 (DNS) 在客户端服务器模型上工作。它使用 UDP 协议进行传输层通信。DNS 使用基于层次域的命名方案。DNS 服务器配置有完全限定域名 (FQDN) 和映射到其各自互联网协议地址的电子邮件地址。

The Domain Name System (DNS) works on Client Server model. It uses UDP protocol for transport layer communication. DNS uses hierarchical domain based naming scheme. The DNS server is configured with Fully Qualified Domain Names (FQDN) and email addresses mapped with their respective Internet Protocol addresses.

DNS 服务器要求提供 FQDN,并通过映射的 IP 地址做出响应。DNS 使用 UDP 端口 53。

A DNS server is requested with FQDN and it responds back with the IP address mapped with it. DNS uses UDP port 53.

Simple Mail Transfer Protocol

简单邮件传输协议 (SMTP) 用于在用户之间传输电子邮件。此任务是通过用户正在使用的电子邮件客户端软件(用户代理)来完成的。用户代理帮助用户键入和格式化电子邮件,并在互联网可用之前存储电子邮件。当提交电子邮件发送时,发送过程由邮件传输代理来处理,该代理通常内置在电子邮件客户端软件中。

The Simple Mail Transfer Protocol (SMTP) is used to transfer electronic mail from one user to another. This task is done by means of email client software (User Agents) the user is using. User Agents help the user to type and format the email and store it until internet is available. When an email is submitted to send, the sending process is handled by Message Transfer Agent which is normally comes inbuilt in email client software.

邮件传输代理使用 SMTP 将电子邮件转发到另一个邮件传输代理(服务器端)。最终用户使用 SMTP 仅发送电子邮件,而服务器通常使用 SMTP 来发送和接收电子邮件。SMTP 使用 TCP 端口号 25 和 587。

Message Transfer Agent uses SMTP to forward the email to another Message Transfer Agent (Server side). While SMTP is used by end user to only send the emails, the Servers normally use SMTP to send as well as receive emails. SMTP uses TCP port number 25 and 587.

客户端软件使用互联网邮件访问协议 (IMAP) 或 POP 协议来接收电子邮件。

Client software uses Internet Message Access Protocol (IMAP) or POP protocols to receive emails.

File Transfer Protocol

文件传输协议 (FTP) 最广泛用于通过网络进行文件传输。FTP 使用 TCP/IP 进行通信,并使用 TCP 端口 21。FTP 在客户端/服务器模型上工作,其中客户端从服务器请求文件,而服务器将请求的资源发送回客户端。

The File Transfer Protocol (FTP) is the most widely used protocol for file transfer over the network. FTP uses TCP/IP for communication and it works on TCP port 21. FTP works on Client/Server Model where a client requests file from Server and server sends requested resource back to the client.

FTP 使用带外控制,即 FTP 使用 TCP 端口 20 来交换控制信息,而实际数据则通过 TCP 端口 21 发送。

FTP uses out-of-band controlling i.e. FTP uses TCP port 20 for exchanging controlling information and the actual data is sent over TCP port 21.

客户端向服务器请求文件。当服务器接收到文件请求时,它为客户端打开一个 TCP 连接并传输文件。传输完成后,服务器关闭连接。对于第二个文件,客户端再次请求,服务器重新打开一个新的 TCP 连接。

The client requests the server for a file. When the server receives a request for a file, it opens a TCP connection for the client and transfers the file. After the transfer is complete, the server closes the connection. For a second file, client requests again and the server reopens a new TCP connection.

Post Office Protocol (POP)

邮局协议版本 3 (POP 3) 是用户代理(客户端电子邮件软件)用于从邮件服务器检索邮件的简单邮件检索协议。

The Post Office Protocol version 3 (POP 3) is a simple mail retrieval protocol used by User Agents (client email software) to retrieve mails from mail server.

当客户端需要从服务器检索邮件时,它在 TCP 端口 110 上与服务器打开一个连接。然后,用户可以访问其邮件并将其下载到本地计算机。POP3 以两种模式工作。最常见的模式为删除模式,即下载电子邮件到本地计算机后从远程服务器删除电子邮件。第二种模式为保留模式,不会从邮件服务器删除电子邮件,并向用户提供以后在邮件服务器上访问邮件的选项。

When a client needs to retrieve mails from server, it opens a connection with the server on TCP port 110. User can then access his mails and download them to the local computer. POP3 works in two modes. The most common mode the delete mode, is to delete the emails from remote server after they are downloaded to local machines. The second mode, the keep mode, does not delete the email from mail server and gives the user an option to access mails later on mail server.

Hyper Text Transfer Protocol (HTTP)

超文本传输协议 (HTTP) 是万维网的基础。超文本是组织良好的文档系统,使用超链接来链接文本文档中的页面。HTTP 在客户端服务器模型上工作。当用户想要访问互联网上的任何 HTTP 页面时,用户端的客户端计算机在端口 80 上启动到服务器的 TCP 连接。当服务器接受客户端请求时,客户端被授权访问网页。

The Hyper Text Transfer Protocol (HTTP) is the foundation of World Wide Web. Hypertext is well organized documentation system which uses hyperlinks to link the pages in the text documents. HTTP works on client server model. When a user wants to access any HTTP page on the internet, the client machine at user end initiates a TCP connection to server on port 80. When the server accepts the client request, the client is authorized to access web pages.

为了访问网页,客户端通常使用 Web 浏览器,Web 浏览器负责启动、维护和关闭 TCP 连接。HTTP 是一种无状态协议,这意味着服务器不会保留有关客户端早期请求的任何信息。

To access the web pages, a client normally uses web browsers, who are responsible for initiating, maintaining, and closing TCP connections. HTTP is a stateless protocol, which means the Server maintains no information about earlier requests by clients.

HTTP 版本

HTTP versions

  1. HTTP 1.0 uses non persistent HTTP. At most one object can be sent over a single TCP connection.

  2. HTTP 1.1 uses persistent HTTP. In this version, multiple objects can be sent over a single TCP connection.

Network Services

计算机系统和电子化系统帮助人类有效工作并探索不可想象的事情。当这些设备连接在一起形成网络时,功能会得到多倍提升。计算机网络能提供的一些基本服务是。

Computer systems and computerized systems help human beings to work efficiently and explore the unthinkable. When these devices are connected together to form a network, the capabilities are enhanced multiple-times. Some basic services computer network can offer are.

Directory Services

这些服务是名称与其值的映射,名称的值可能是变量值或固定值。此软件系统有助于存储信息、组织信息并提供用于访问信息的不同方法。

These services are mapping between name and its value, which can be variable value or fixed. This software system helps to store the information, organize it, and provides various means of accessing it.

  1. Accounting In an organization, a number of users have their user names and passwords mapped to them. Directory Services provide means of storing this information in cryptic form and make available when requested.

  2. Authentication and Authorization User credentials are checked to authenticate a user at the time of login and/or periodically. User accounts can be set into hierarchical structure and their access to resources can be controlled using authorization schemes.

  3. Domain Name Services DNS is widely used and one of the essential services on which internet works. This system maps IP addresses to domain names, which are easier to remember and recall than IP addresses. Because network operates with the help of IP addresses and humans tend to remember website names, the DNS provides website’s IP address which is mapped to its name from the back-end on the request of a website name from the user.

File Services

文件服务包括通过网络共享和传输文件。

File services include sharing and transferring files over the network.

  1. File Sharing One of the reason which gave birth to networking was file sharing. File sharing enables its users to share their data with other users. User can upload the file to a specific server, which is accessible by all intended users. As an alternative, user can make its file shared on its own computer and provides access to intended users.

  2. File Transfer This is an activity to copy or move file from one computer to another computer or to multiple computers, with help of underlying network. Network enables its user to locate other users in the network and transfers files.

Communication Services

  1. Email Electronic mail is a communication method and something a computer user cannot work without. This is the basis of today’s internet features. Email system has one or more email servers. All its users are provided with unique IDs. When a user sends email to other user, it is actually transferred between users with help of email server.

  2. Social Networking Recent technologies have made technical life social. The computer savvy peoples, can find other known peoples or friends, can connect with them, and can share thoughts, pictures, and videos.

  3. Internet Chat Internet chat provides instant text transfer services between two hosts. Two or more people can communicate with each other using text based Internet Relay Chat services. These days, voice chat and video chat are very common.

  4. Discussion Boards Discussion boards provide a mechanism to connect multiple peoples with same interests.It enables the users to put queries, questions, suggestions etc. which can be seen by all other users. Other may respond as well.

  5. Remote Access This service enables user to access the data residing on the remote computer. This feature is known as Remote desktop. This can be done via some remote device, e.g. mobile phone or home computer.

Application Services

这些内容只不过是为用户提供基于网络的服务,例如网络服务、数据库管理和资源共享。

These are nothing but providing network based services to the users such as web services, database managing, and resource sharing.

  1. Resource Sharing To use resources efficiently and economically, network provides a mean to share them. This may include Servers, Printers, and Storage Media etc.

  2. Databases This application service is one of the most important services. It stores data and information, processes it, and enables the users to retrieve it efficiently by using queries. Databases help organizations to make decisions based on statistics.

  3. Web Services World Wide Web has become the synonym for internet.It is used to connect to the internet, and access files and information services provided by the internet servers.