CSC8021_computer network_Routing

发布时间:2024年01月15日

routing

在这里插入图片描述
How to design frames and check they are correct when they arrive
How to avoid frames/packets being collided / corrupted
How to find best path for the frames / packets to trave
如何设计框架并在到达时检查它们是否正确
如何避免帧/数据包被碰撞/损坏
如何找到帧/数据包传输的最佳路径
在这里插入图片描述

Routing algorithms are responsible for deciding which output line an incoming packet should be transmitted on.
Routing has two distinct phases
Routing algorithm: Routers exchange information to decide on best routes and store routes in tables
Forwarding: Routers forward packets according to what the tables say

路由算法负责决定传入数据包应该在哪条输出线上传输。
路由有两个不同的阶段
路由算法:路由器交换信息以决定最佳路由并将路由存储在表中
转发:路由器根据表中的内容转发数据包

Build a table within a router. So it knows where to send a packet.
Routing algorithm, sending info about distances, then use algorithms to build tables.
Then it can be forwarded.
在路由器中建立一个表。所以它知道在哪里发送数据包。
路由算法,发送有关距离的信息,然后使用算法来构建表。
然后可以转发。

routing choice

在这里插入图片描述大多数主机都有许多出站线路,因此路由算法必须从中选择“最好的”。
这取决于
互连速度(避免慢速线路)
目标主机的表观负载(避免慢速机器)
拥堵(避开繁忙路线)
Lots of options for lines and destinations.

The selection of a route depends on some performance criterion.
The simplest criterion is to choose the minimum hop route, i.e., the route with the fewest intermediate nodes.
Should two or more such routes exist a probabilistic choice is made.
A generalisation of this criterion is least-cost routing in which each hop has an associated cost and the route whose cumulative hops cost the least will be chosen.
路线的选择取决于一些性能标准
最简单的标准是选择最小跳路由,即具有最少中间节点的路由。
如果存在两个或多个这样的路线,则进行概率选择
该标准的概括是最小成本路由,其中每个跳具有相关联的成本,并且将选择其累积跳成本最小的路由。

Choose fewest hops, not always the best, as the route may be lower than one this 5 hops or machines, as it has newer or better technology (perhaps fiber optic vs copper line).
For second point: makes since of cost of hops is both the same, but does not work for large network.
选择最少的跳数,而不总是最好的,因为路线可能比这5跳或机器中的一跳低,因为它有更新或更好的技术(也许是光纤与铜线)。
第二点:由于跳数成本相同,但不适用于大型网络。

routing classification

Adaptive (dynamic) algorithms attempt to adjust to traffic changes. Measurements are made of the network traffic during network operation, and changes are made to the algorithm if necessary.
Advantage: Adapts to changing network conditions, thus outcome of performance can depend on time and location of decisions
Disadvantage: The propagation of routing packets increases network load, and under higher sensitivity the route will oscillate reactively to temporary fluctuations in network traffic.
Non-adaptive (static) algorithms do not adjust to changes in network traffic. In this case some predefined strategy is used, which does not change during network operation.
自适应(动态)算法试图适应交通变化。在网络操作期间对网络流量进行测量,并在必要时对算法进行更改
优点:适应不断变化的网络条件,因此性能的结果可能取决于决策的时间和位置
缺点:路由包的传播增加了网络负载,在更高的灵敏度下,路由会对网络流量的临时波动做出反应性振荡
非自适应(静态)算法不适应网络流量的变化。在这种情况下,使用一些预定义的策略,该策略在网络操作期间不会改变。

Adaptive to various conditions, can adapt to new nodes being added/removed. They continuously measure network and update their tables accordingly.

For non-adaptive, may be manually done by network admin for LAN, they may update the tables themselves.
适应各种条件,可以适应正在添加/删除的新节点。他们不断测量网络,并相应地更新表格。
对于非自适应,可以由LAN的网络管理员手动完成,他们可以自己更新表。

Routing strategies – Fixed Routing(路由策略-固定路由)在这里插入图片描述

In a fixed strategy there is a single route between each pair of nodes.
Each node has a table which maps the destination of a datagram to the next node on the route.
Alternatively, the same information can be stored in a single centrally held matrix.
A fixed strategy works well for a reliable network with a steady workload.
In such a strategy there is no difference between a datagram and virtual circuit approach.
在固定策略中,每对节点之间只有一条路由
每个节点都有一个表,该表将数据报的目的地映射到路由上的下一个节点
或者,相同的信息可以存储在单个中央保持的矩阵中
固定策略适用于具有稳定工作负载的可靠网络
在这种策略中,数据报和虚拟电路方法之间没有区别。

So form A to Z you always go through a fixed set of nodes, has been manually added to network admin.

If the network is consistent, doesn’t really need an adaptive algorithm, as there are overheads for the algorithm and takes up a bit of bandwidth and computation.

Is like a virtual circuit.
所以从A到Z,你总是要经过一组固定的节点,已经手动添加到网络管理中。
如果网络是一致的,就不需要自适应算法,因为算法会有开销,而且会占用一些带宽和计算。
就像一个虚拟电路。

Routing strategies – Flooding

In a flooding strategy the source sends a packet to every neighbor, which does the same (except to the source) and so on.
Eventually the destination will receive at least one copy of the packet.
For the flood to stop a node must remember every packet it has seen, so it will not forward duplicates.
Although flooding clearly uses a lot of network resources it does satisfy the routing requirements, also because every possible route will be tried, the shortest path will be found.
在洪泛策略中,源向每个邻居发送一个数据包,每个邻居也会这样做(除了源),以此类推
最终,目的地将接收该分组的至少一个副本
为了让洪水停止,节点必须记住它看到的每一个数据包,这样它就不会转发重复的数据包
尽管洪泛显然使用了大量的网络资源,但它确实满足了路由要求,也因为会尝试每一条可能的路由,从而找到最短的路径。

Kind of brute force, but good for getting a packet via the quickest destination, but it can cause congestion.

Destination could receive multiple copies. So each node/router caches the packet, and will then discard any duplicate packets.

Packets have a countdown number, so set the value to 10, so for each hop it should go down to zero, when it goes to zero, the packet is deleted. This prevents endless looping of packets.
有点暴力,但有利于通过最快的目的地获取数据包,但可能会导致拥塞。
目标可以接收多个副本。因此,每个节点/路由器都会缓存数据包,然后丢弃任何重复的数据包。
数据包有一个倒计时,所以将值设置为10,所以对于每一跳,它都应该降到零,当它降到零时,数据包就会被删除。这样可以防止数据包无休止地循环。

Routing strategies – Random routing

In a random strategy a node simply selects the next node at random (or in rotation)from all its neighbours (excluding the previous node in the route).
? Has a similar simplicity to flooding but uses far less resources.
? The probabilities of the choice may be weighted such that there is a preferred next node.
? A random strategy is good at distributing load around a network, but it is unlikely that such a strategy will deliver a packet by the best possible route.
在随机策略中,节点只是从所有邻居(不包括路由中的前一个节点)中随机(或轮流)选择下一个节点。
·具有类似于洪水的简单性,但使用的资源少得多。
·选择的概率可以被加权,使得存在优选的下一节点。
·随机策略擅长在网络中分配负载,但这种策略不太可能通过最佳路由来传递数据包。

Link State Routing (LSR)

Each router must do the following:

  1. Discover its neighbours, learn their network address.
  2. Measure the delay to each of its neighbours.
  3. Construct a packet telling all it has just learned.
  4. Distribute this packet to all other routers.
  5. Compute the best route (minimum delay) to every other router using a static algorithm.
    Can be run periodically but is rather static (the algorithm must run to
    completion before new routes are known).
    每台路由器必须执行以下操作:
    1.找到它的邻居,知道他们的网络地址。
    2.测量到其每个邻居的延迟。
    3.构建一个数据包,告诉它刚刚学到的所有东西。
    4.将此数据包分发到所有其他路由器。
    5.使用静态算法计算到每台其他路由器的最佳路由(最小延迟)。
    可以定期运行,但相当静态(算法必须运行到在知道新路线之前完成)。

LSR – 1. Discover neighbor

在这里插入图片描述

LSR – 2. Measure line delay

在这里插入图片描述

LSR – 3. Build link state packets

在这里插入图片描述

LSR – 4 Distribute packets

Uses flooding to distribute link state packets but needs algorithm to avoid distributing duplicates.
使用洪泛分发链路状态数据包,但需要算法来避免分发重复。

LSR – 5. Compute best route

Use a static algorithm, such as shortest path (Dijkstra) to calculate best route to all routers based on information in link state packets.
使用静态算法(如最短路径(Dijkstra))根据链路状态数据包中的信息计算所有路由器的最佳路由。

Dijkstra’s Algorithm(Shortest Path)

Shortest Path Routing (Dijkstra’s Algorithm)

The idea is to build a graph of the subnet.
– Each node of the graph representing a router.
– Each arc of the graph representing a communication line.
? Each arc is labelled with cost/distance.
? To choose a route between a given pair of routers, the algorithm just finds the shortest path between them on the graph.
? There are several metrics that can be used to measure the path length
– Number of hops
– Geographical distance in kilometres
– Mean queuing delay
– Transmission delay for some standard test packet (e.g., LSR)
– A combination of any of them.
? Algorithm can be run periodically but is rather static
我们的想法是建立一个子网图。

  • 图中的每个节点代表一个路由器。
  • 图中的每个弧代表一条通信线路。
    ·每个弧都标有成本/距离。
    ·要在给定的一对路由器之间选择一条路由,算法只需在图上找到它们之间的最短路径。
    ·存在可用于测量路径长度的若干度量
  • 跳数
  • 地理距离(公里)
  • 平均排队延迟
  • 一些标准测试分组的传输延迟(例如,LSR)
  • 他们中的任何一个组合。
    ·算法可以定期运行,但相当静态
    在这里插入图片描述
    ? Eventually, each node will be labelled with its distance from the source node along the best-known path.
    ? Initially, no paths are known, so all nodes are labelled with infinity.
    ? As the algorithm progresses and paths are found, the labels may change, reflecting the best paths.
    ? The labels are either tentative or permanent. Initially, all labels are tentative. When it is discovered that a label represents the shortest possible path from the source to that node, it is made permanent and never changed thereafter
    ·最后,每个节点将被标记为沿着最佳已知路径沿着与源节点的距离。
    ·最初,没有已知的路径,因此所有节点都标记为无穷大。
    ·随着算法的进展和路径的发现,标签可能会改变,反映最佳路径。
    ·标签是暂时的或永久的。最初,所有标签都是暂定的。当发现某个标签表示从源到该节点的最短可能路径时,该标签将成为永久性的,此后将不再更改

Dijkstra’s Algorithm – Application and example
current node <- source
current total <- 0
For each row (until set contain all nodes):
Step 1: add current node to the new set
Step 2: set all the cells of the current node to “–” (entire column)
Step 3: for all neighbours of the current node (not already in the set)
if ((current total + neighbours cost) < neighbours total) or first row
set the corresponding cell on the row to (current total + neighbours cost, current
node)
Step 4: duplicate from previous row all empty cells (if first row put (inf, -))
current node <- node with smallest cost
current total <- current node cost
Shortest path: go from destination to source following the lower cost
对于每一行(直到集合包含所有节点):
步骤1:将当前节点添加到新集合
第二步:将当前节点的所有单元格设置为“-”(整列)
步骤3:对于当前节点的所有邻居(尚未在集合中)
if((当前总数+邻居成本)<邻居总数)或第一行
将行上的相应单元格设置为(当前总计+邻居成本,当前
节点)
第4步:从上一行复制所有空单元格(如果第一行放置(inf,-))
当前节点<最小代价节点
当前总成本<-当前节点成本
最短路径:从目的地到源,遵循较低的成本
在这里插入图片描述
在这里插入图片描述

Distance Vector Routing

? Each router maintains a table giving the best (currently known) distance to each destination, and which line must be used to get there.
? These tables are updated periodically by exchanging information with the neighbouring routers, so routes adapt dynamically to network changes.
? If a node I receives a table from its neighbour J saying the delay to node K (from J) is x, and if the delay from I to J is y,then the delay from I to K via J is x+y.
每个路由器都维护一个表,给出到每个目的地的最佳(当前已知)距离,以及必须使用哪条线路才能到达那里。
·这些表通过与相邻路由器交换信息定期更新,因此路由动态适应网络变化。
·如果节点I从其邻居J接收到一个表,该表表明(从J)到节点K的延迟是x,并且如果从I到J的延迟是y,则从I经由J到K的延迟是x+y。
在这里插入图片描述在这里插入图片描述

Distance Vector Routing: Count-to-Infinity

? Distance Vector Routing algorithm reacts
– Rapidly to good news (new better route)
– Slowly to bad news (best route goes down).
? When a router becomes unreachable (or dies), the distance from all routers to it increases slowly to infinity after each routing table exchange cycle.
? It will take lots of exchange cycles before a router is declared unreachable
– Called Convergence Time
? One solution is to set infinity to longest path + 1.
·距离矢量路由算法反应
- 快速到好消息(新的更好的路线)
- 慢慢到坏消息(最佳路线下降)。
·当路由器变得不可达(或死亡)时,在每个路由表交换周期之后,从所有路由器到它的距离缓慢增加到无穷大。
·在路由器被声明为不可达之前,将需要大量的交换周期
英文名称:Convergence Time
一个解决方案是将无穷大设置为最长路径+1。
在这里插入图片描述

Routing Methods Analysis

Least hop routes

? With Dijkstra set all costs to 1 to find the least hop.
? With Distance vector the least hop route is the first to be found for each destination.
·Dijkstra将所有成本设置为1,以找到最少的跳数。
·使用距离向量,对于每个目的地,最少跳数的路由是首先找到的。

Dijkstra’s Algorithm

1.Strengths
– Dijkstra is easier when the network is small and holding all the knowledge is easy.
– Centrally held total knowledge of a network’s link costs.
– Best route to and from any node is easily found with a single look up.

  • Dijkstra是更容易当网络是小的和持有所有的知识是容易的。
  • 集中掌握网络链路成本的全部信息。
  • 只需一次查找即可轻松找到往返任何节点的最佳路由。
    2.Weaknesses
    – Computationally expensive with larger networks.
    – If changes occur then the Dijkstra may need totally recalculating, whereas distance vector can
    adapt.
  • 对于较大的网络,计算成本很高。
  • 如果发生变化,那么Dijkstra可能需要完全重新计算,而距离矢量可以适配。

Distance Vector Routing

1.Strengths
– Distance vector is distributed
– Local costs can be calculated very quickly which means it can react to local changes easily.
– If costs are fairly similar then the number of iterations needed to find the least cost path will be close to the shortest path length for the most distant pair of nodes(shortest path ≈ least cost path).

  • 距离矢量分布
  • 本地成本可以非常快速地计算,这意味着它可以很容易地对本地变化做出反应。
  • 如果成本相当相似,则找到最小成本路径所需的迭代次数将接近最远节点对的最短路径长度(最短路径=最小成本路径)。
    2.Weaknesses
    – More distant costs take longer to find.
    – However, if the variation in costs is high, then the number of iterations will tend to be the maximum(non-repeating) path length between any 2 nodes.
  • 更远的成本需要更长的时间才能找到。
  • 然而,如果成本的变化很高,则迭代次数将倾向于任何2个节点之间的最大(非重复)路径长度。

Congestion Control Algorithms

Congestion

Congestion is when too many packets are present in the subnet and performance degrades.
拥塞是指子网中存在太多数据包,导致性能下降。
在这里插入图片描述
As incoming traffic increases faster than the offered load of the system, routers cannot cope and begin to lose packets.
当传入流量的增长速度超过系统提供的负载时,路由器无法科普,并且开始丢失数据包。

Offered Load

Offered load is the product of the arrival time and mean service time of packets into a system. We can describe it mathematically using Little’s Theorem:L = λW
提供的负载是分组到达系统的时间和平均服务时间的乘积。我们可以用利特尔定理来描述它:L = λW
Where,
? L represents the mean number of packets present in a system
? λ represents the arrival rate of packets
? W represents the mean waiting time of a packet
Therefore, the offered load of a system is tied to the amount of computation present, or in modern terms the level of operator parallelism.
Cooper, Robert B. (1972). Introduction to queueing theory. New York: Macmillan
其中:
· L表示系统中存在的分组的平均数量
· λ表示分组的到达速率
· W表示数据包的平均等待时间
因此,系统提供的负载依赖于当前的计算量,或者用现代术语来说,依赖于操作符并行性的水平。
作者声明:库珀(1972年)。介绍一个理论。纽约:麦克米伦

Approaches to Congestion Control

? Network Provisioning
– Build a network well matched to the traffic that it carries.
– Increase or decrease resources if needed (auto-scaling).
? Traffic-Aware Routing
– Compute routes taking topology and traffic into account.
– Shift traffic from congestion hotspots by changing link weights
– Split traffic across multiple paths.
? Traffic Shaping
– Regulate the average rate and burstiness of data transmission
·网络配置

  • 建立与其承载的流量相匹配的网络。
  • 根据需要增加或减少资源(自动缩放)。
    ·网络感知路由
  • 考虑拓扑和流量计算路由。
  • 通过改变链路权重将流量从拥塞热点转移
  • 在多条路径上拆分流量。
    ·交通塑造
  • 调节数据传输的平均速率和突发性

Leaky Bucket Algorithm

在这里插入图片描述Turns an uneven flow of packets from a host into an even flow of packets into the network. This smooths burstiness from a source and reduces the chances of congestion.
将来自主机的不均匀数据包流转换为进入网络的均匀数据包流。这平滑了来自源的突发并减少了拥塞的机会。

Token Bucket

在这里插入图片描述The bucket holds tokens output by a clock at a constant rate. For a packet to be transmitted it must capture and destroy one token.
This algorithm allows for large bursts of data, and can be fixed by putting a leaky bucket after a token bucket.
桶以恒定速率保存由时钟输出的令牌。对于要传输的数据包,它必须捕获并销毁一个令牌。
该算法允许大的数据突发,并且可以通过在令牌桶之后放置漏桶来修复。

Load Shedding

Load shedding is the processing of routers dropping packets to adapt to continued network congestion.
Simulations show that discarding packets early prevents the network clogging entirely.
Load shedding is best used in systems where data fidelity is not crucial but can be employed in any networked system. Packets are usually chosen at random, but simple logic can be applied depending on the system specifics.
? Wine approach: Older packets are of greater value, therefore new packets are dropped
? Milk approach: Newer packets are of greater value, therefore old packets are dropped
负载削减是路由器丢弃数据包以适应持续的网络拥塞的处理。
仿真结果表明,早期丢弃数据包可以完全防止网络堵塞。
减载最好用在数据保真度不重要的系统中,但可以用在任何联网系统中。数据包通常是随机选择的,但可以根据系统的具体情况应用简单的逻辑。
· Wine方法:较旧的数据包具有更大的价值,因此丢弃新的数据包
·牛奶方法:较新的数据包具有更大的价值,因此旧的数据包被丢弃

文章来源:https://blog.csdn.net/weixin_52297290/article/details/131013489
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。