Wide Area Network Protocols
Wide Area Network 广域网
different networks may be connected at any level of OSI layers
physical layer: repeater
data link layer: bridge
network layer and upper layers: router/gateway
Network routing 网络路由:
- one node may send packets (i.e.即, a message that is de-assembled to fixed size units) to another which is not locally connected, but situated in throughout a city, a country, or the continent.
- network protocols search for the best route(s) (usually the cheapest and the fastest) between two points —> routing algorithms
- network routing is not straightforward:
– environment in real network is changing dynamically
– a good route may attract lots of traffic —> leading to congestion, or even deadlock
Congestion and Deadlock
Congestion
an excessive过度 buildup堆积 of packets at one or more network nodes caused by
- a failure of one or more network nodes/links
- the number of packets exceeding the network’s ability
- etc…
It may cause a chain reaction because the congestion at one node hampers妨碍 its ability to receive packets from other nodes
Deadlock
congestion becomes so severe that nothing moves
- store-and -forward deadlock
- reassembly deadlock
Congestion Control
-
packet elimination 数据包消除
– if an excessive buildup of packets occurs, eliminate some of them
– unlucky senders’ destroyed packets do not reach their destination: senders must determine the fate of their packets; adverse不利的 effect is limited (for most cases). -
flow control
– flow control protocols may regulate规定 the number of packets to be transmitted between two nodes.
– congestion can still occur, if too many packets are flowing into a node -
buffer allocation 缓冲区分配
– a source node requests nodes on the route for reserving保留 a sufficient buffer space
– if the request is rejected, a source node looks for another route -
choke packet
– each node puts any link(s) to a warning state if its utilization exceed a certain level
– for any packet ongoing不间断的 the link under a warning state, its source node is notified通知 by a choke packet 被阻塞包通知
– a node, that has received a choke packet, reduces the amount of transmission to that link 接收到阻塞包的话就减少对那个link的发送
Network Routing
我们想要解决两个问题:
- 如何Router1知道目的地是哪个(比如Router3)
- 如何让Router1知道到Router3的最短路径
Routing table
- we wish to find the least cost route
- given a network, a routing table shows the associated cost for communicating with each destination node
- it does not specify具体说明 the entire route for each destination, but it only indicates the next node
- the cheapest route from A to F is A—>B—>E—>F
how can we find such route?
Centralised routing 集中式路由选择
- a single node maintains all interconnection information, which is then broadcasted to the rest of nodes
- simple, but a failure of the central node, or any link connected to it, may affect entire network.
集中式路由选择就是说有一个中心点,它保存了整个网络的路由信息。会广播给其他的节点。但是如果这个点坏了,或者link坏了,可能会影响整个网络。
Distributed routing 分布式路由选择
- no central control, but each node determines and maintains the routing information independently
– a node finds its neighbors and calculates the associated costs
– each neighbor repeats the same procedure in turn - complex, but a failure of a node or a link may cause little disruption扰乱
分布式路由时每个节点会存储相邻路由表信息。效率比较高。复杂。但是一个点出了问题对整个网络的干扰比较小
Static routing 静态路由
- once routing information is determined, it will not be modified调整,改进.
- simple, but insensitive to changing condition
Adaptive routing 自适应路由
- each node updates routing information according to dynamically changing network condition
- pitfall陷阱: some packet may shuttle back and forth among several nodes, thus never making any progress towards its eventual destination 一些包可能会在多个节点中来回穿梭,因此无法朝着最终的目的地前进
- can provide the recent information for link cost, but high overhead开销 for updating routing information frequently.
Hierarchical Routing 分层路由
当有太多节点在同一个网络里的时候你很难决定一个路径。所以我们可以structure the network hierarchically
Some features of hierarchical routing:
- all nodes are divided into groups, called domains, each of which is separate and independent network
- a route between two nodes in a common domain is determined using the domain’s protocol
- each domain has a designated指定 node, referred to as a router or a gateway, that searches for route(s) between domains
- it may consist of multiple subdomains
The Internet uses a hierarchical structure
RIP (routing information protocol)
- routers in the network let each other know the shortest route to a specified network
- typically, it uses a hop count (the number of intermediate中间的 routers) to measure the distance.
Procedure:
1) R1 informs N2它可以通过1 hop到达N1
2)R2连接着N2所以它现在也知道自己可以两跳到N1,存储在routing table中
3)R2向N3广播自己可以一跳到N2和N4,两跳到N1
4)R3存储从N3获取的信息
5)R3向N5广播自己可以一跳到N3,两跳到N2和N4,三跳到N1
通过不停地重复这个过程,最终N6会知道自己可以通过N4三跳到N1,通过N5四跳到N1。
Dijkstra’s Algorithm 狄克斯特拉算法
centralised forward search algorithm 集中前向搜索算法
- 定义S为一个节点的集合。最初,S里只包含一个A节点。
- 对每一个在S外的节点node X,定义一个cost(X)作为仅使用S中的节点从A到X的最便宜路径的花销。
- 定义一个prior(X)作为最便宜的路径中,X之前(preceding)的那个节点。如果根本不存在这样的link,那么cost(X)是一个任意大的值(arbitrarily large value)
- 定义一个集合W,包含所有的不在S里,但是却和S里的节点有直接连接的节点。(其实就是邻居)
- 从W里选择一个cost(X)最小的节点X。将这个节点X添加到S中
- 只要还有节点不在S里,就重复从2开始的步骤
1)首先将A作为最初始的点,也是集合S的第一个元素。与A相邻的只有B和C,X选择B和C之中cost比较小的C。prior填写为B和C元素前面的那个元素。
2)然后C点作为上一轮的X,加入集合S。此时能与A,C有直接连接的B,D,E都进入集合W。cost计算应当是经过点C所计算出的cost。从A到点B的cost最低,加入X
3)接下来,X变成A,B,C。相邻的则有D,E和F。计算最短路径的时候可以计算经过B的和经过C的两种。这两种选择最低的作为cost。计算完后选择,如果有cost是一样的,随机选择一个。
4)按照这样的方式不停进行。直到所有的点都被收进S集合。例题中的最后一行就是最终结果。
Bellman-Ford Algorithm 贝尔曼-福特算法
nodeA的邻居们如何知道自己到Z的最便宜的路径呢? ----> Bellman-Ford algorithm
它是一种Distributed backward search algorithm 分布式反向搜索算法
- For all nodes in the network, do —
for each neighboring node N, insert the entry (N, link cost to N) in the current routing table T. - Do the following procedures for all nodes, while their routing tables may possibly change —
- obtain获得 a neighbor N’s routing table
- For each node Z in the network, calculate: 'new cost = current cost to N + N’s cost to Z’
– if Z is not in T, insert the pair (N, new cost)
– else if this new cost is less than the current cost to Z, then replace the entry with (N, new cost)
没有的话插入,有的话看哪个cheapest替换即可。
粗浅的理解来看就是:(不一定对,会修改。)
第一次interation(迭代)是只考虑了与node相邻的点的路径。
第二次迭代的时候,比如算A到F。只考虑中间有一个点的路径。即为A到B到F
第三次迭代的时候,算A到F可以考虑有两个点的路径。比较一下所有的路径的可能性谁的cost最小放在table里。