A routing protocol is a set of processes, algorithms, and messages that are used to exchange routing information. Routing information is used to populate the routing table with the best paths to destinations in the network. As routers learn of changes to network reachability, this information is dynamically passed onto other routers.
路由協定是一組用來交換路由資訊的程序、演算法及訊息。路由資訊會用來將網路中到達目的地的最佳路徑填入路由表。當路由器得知網路可達性的變化時,這項資訊會動態地傳遞給其他路由器。
All routing protocols have the same purpose: to learn about remote networks and to quickly adapt whenever there is a change in the topology. The method that a routing protocol uses to accomplish this purpose depends upon the algorithm that it uses and the operational characteristics of the protocol. The operations of a dynamic routing protocol vary depending on the type of routing protocol and on the routing protocol itself.
所有路由協定的目的都相同:得知遠端網路的資訊,並在拓樸發生變化時迅速調適。路由協定達成此目的所使用的方法,取決於其所採用的演算法以及該協定的運作特性。動態路由協定的運作方式,會依路由協定的類型及協定本身而有所不同。
Although routing protocols provide routers with up-to-date routing tables, they put additional demands on the memory and processing power of the router. First, the exchange of route information adds overhead that consumes network bandwidth. Even though this is almost never an issue in networks today, in rare cases this overhead might be a problem particularly where low-bandwidth links are used between routers. Second, after the router receives the route information, protocols such as Enhanced Interior Gateway Routing Protocol (EIGRP) and OSPF process it extensively to offer information to the routing table. So, the routers that use these protocols must have sufficient processing capacity to implement the algorithms of the protocol and to perform timely packet routing and forwarding.
雖然路由協定能為路由器提供最新的路由表,但也會對路由器的記憶體與處理能力帶來額外負擔。首先,路由資訊的交換會增加額外負荷,消耗網路頻寬。儘管在現今的網路中這幾乎從不構成問題,但在極少數情況下,尤其是路由器之間使用低頻寬鏈路時,這種額外負荷可能會成為問題。其次,路由器收到路由資訊後,像增強型內部閘道路由協定(EIGRP)及 OSPF 這類協定會對其進行大量處理,才能提供資訊給路由表。因此,使用這些協定的路由器必須具備足夠的處理能力,才能執行該協定的演算法,並即時完成封包路由與轉送。
An autonomous system, otherwise known as a routing domain, is a collection of routers under a common administration such as an internal company network or an ISP network. Because the internet is based on the autonomous system concept, the following two types of routing protocols are required:
自治系統,又稱為路由網域,是在共同管理下的一組路由器集合,例如公司內部網路或 ISP 網路。由於網際網路是以自治系統的概念為基礎,因此需要以下兩種類型的路由協定:
- IGP:An IGP routing protocol is used to exchange routing information within an autonomous system. EIGRP, Intermediate System-to-Intermediate System (IS-IS), OSPF, and the legacy routing protocol—Routing Information Protocol (RIP)—are examples of IGPs for IPv4.IGP:IGP 路由協定用於在自治系統內交換路由資訊。EIGRP、中介系統對中介系統(IS-IS)、OSPF,以及舊式路由協定路由資訊協定(RIP),都是 IPv4 的 IGP 範例。
- EGP: An Exterior Gateway Protocol (EGP) routing protocol is used to route between autonomous systems. Border Gateway Protocol (BGP) is the EGP used for IPv4 today.EGP:外部閘道協定(EGP)路由協定用於在自治系統之間進行路由。邊界閘道協定(BGP)是目前用於 IPv4 的 EGP。
Within an autonomous system, most IGP routing can be classified as distance vector or link-state routing:
在自治系統內,大多數 IGP 路由可分類為距離向量或鏈路狀態路由:
- Distance vector: The distance vector routing approach determines the direction (vector) and distance (such as router hops) to any link in the internetwork. Some distance vector protocols periodically send complete routing tables to all connected neighbors. In large networks, these routing updates can become very large, causing significant traffic on the links. The only information that a router knows about a remote network is the distance or metric to reach this network and the path or interface to use to get there. Distance vector routing protocols do not have an actual map of the network topology. RIP is an example of a distance vector routing protocol while EIGRP is an advanced distance vector routing protocol that provides additional functionality.距離向量:距離向量路由方式會判斷到互連網路中任何鏈路的方向(向量)與距離(例如路由器躍點數)。有些距離向量協定會定期將完整路由表傳送給所有相連的鄰居。在大型網路中,這些路由更新可能會變得非常龐大,導致鏈路產生大量流量。路由器對遠端網路唯一了解的資訊,就是到達該網路的距離或度量值,以及要使用的路徑或介面。距離向量路由協定並沒有實際的網路拓樸地圖。RIP 是距離向量路由協定的一個範例,而 EIGRP 則是提供額外功能的進階距離向量路由協定。
- Link state: The link-state approach, which uses the shortest path first (SPF) algorithm, creates an abstract of the exact topology of the entire internetwork or at least of the partition in which the router is situated. A link-state routing protocol is like having a complete map of the network topology. A link-state router uses the link-state information to create a topology map and to select the best path to all destination networks in the topology. The OSPF and IS-IS Protocols are examples of link-state routing protocols.鏈路狀態:鏈路狀態方式使用最短路徑優先(SPF)演算法,建立整個互連網路(或至少路由器所在分區)確切拓樸的抽象表示。鏈路狀態路由協定就像擁有一份完整的網路拓樸地圖。鏈路狀態路由器會使用鏈路狀態資訊建立拓樸地圖,並選出通往拓樸中所有目的地網路的最佳路徑。OSPF 與 IS-IS 協定都是鏈路狀態路由協定的範例。
EGP, specifically BGP, uses a Path Vector routing approach for routing between autonomous systems. Path Vector is similar to distance vector but the routing update records the originating autonomous system and all other autonomous systems that the update is transiting through.
EGP,特別是 BGP,在自治系統之間的路由使用路徑向量(Path Vector)路由方式。路徑向量與距離向量類似,但路由更新中會記錄發起的自治系統,以及該更新所經過的所有其他自治系統。
Routing protocols can also be classified as classful or classless:
路由協定也可分類為有類別或無類別:
- Classless routing protocol: RIP version 2 (RIPv2), EIGRP, OSPF, IS-IS, and BGP are classless routing protocols and can be considered second-generation protocols because they are designed to address the limitations of classful routing protocols. A classless routing protocol is a protocol that advertises subnet mask information in the routing updates for the networks advertised to neighbors. As a result, this feature enables the protocols to support discontiguous networks (where subnets of the same major network are separated by a different major network) and Variable Length Subnet Masking (VLSM). This allows the routers to exchange routing information for subnets (such as 10.1.1.0/24) as well as for major networks (for example, 10.0.0.0/8). In the following figure, when routers R1 and R3 send routing advertisements to router R2, they include the subnet mask in the updates (10.1.1.0/24 and 10.2.2.0/24), so R2 learns about those specific subnets.無類別路由協定:RIP 第 2 版(RIPv2)、EIGRP、OSPF、IS-IS 及 BGP 都是無類別路由協定,可視為第二代協定,因為它們的設計目的就是解決有類別路由協定的限制。無類別路由協定是一種在向鄰居發布的路由更新中,會通告子網路遮罩資訊的協定。因此,這項特性使這些協定能夠支援不連續網路(同一主要網路的子網路被另一個不同主要網路隔開)以及可變長度子網路遮罩(VLSM)。這讓路由器能夠針對子網路(例如 10.1.1.0/24)以及主要網路(例如 10.0.0.0/8)交換路由資訊。在下圖中,當路由器 R1 與 R3 向路由器 R2 發送路由通告時,它們會在更新中包含子網路遮罩(10.1.1.0/24 及 10.2.2.0/24),因此 R2 會得知這些特定子網路的資訊。

- Classful routing protocol: Classful routing protocols such as RIP version 1 (RIPv1) and Interior Gateway Routing Protocol (IGRP) are legacy protocols and not used today. They do not advertise the subnet mask information within the routing updates. Therefore, only one subnet mask can be used within a major network. VLSM and discontiguous networks are not supported.有類別路由協定:有類別路由協定,例如 RIP 第 1 版(RIPv1)及內部閘道路由協定(IGRP),都是舊式協定,現今已不再使用。它們不會在路由更新中通告子網路遮罩資訊。因此,一個主要網路內只能使用一種子網路遮罩,不支援 VLSM 與不連續網路。

The concept of route summarization plays a really important role when using dynamic routing protocols because it optimizes the number of routing updates exchanged between the routers in the routing domain. The purpose of route summarization is to aggregate multiple routes into one route advertisement. For example, if Router A knows about all the subnets 10.1.0.0/24, 10.1.1.0/24, 10.1.2.0/24, and so on, all the way up to 10.1.255.0/24, then instead of sending all of these routes to its neighbors, you could configure it to send the summary route 10.1.0.0/16. In this case, Router A is telling its neighbors that it knows how to get to all networks that have the same first 16 bits as 10.1.0.0, in other words that start with "10.1".
路由彙總的概念在使用動態路由協定時扮演相當重要的角色,因為它能最佳化路由網域中路由器之間交換的路由更新數量。路由彙總的目的是將多條路由聚合成一則路由通告。舉例來說,如果路由器 A 得知 10.1.0.0/24、10.1.1.0/24、10.1.2.0/24,一直到 10.1.255.0/24 的所有子網路,那麼你可以設定它發送彙總路由 10.1.0.0/16,而不是將這些路由全部傳送給鄰居。在這種情況下,路由器 A 是在告訴鄰居,它知道如何到達所有與 10.1.0.0 前 16 位元相同的網路,換句話說,就是所有以「10.1」開頭的網路。
All classless routing protocols support manual route summarization. Some of these protocols have autosummarization at the major network boundary, to the classful network address, on by default. For example, assume Router A has autosummarization on and it knows about all the subnets 10.1.0.0/24, 10.1.1.0/24, 10.1.2.0/24, and so on, all the way up to 10.1.255.0/24. In this case, Router A would automatically send the 10.0.0.0/8 route to any of its neighbors that are in another major network.
所有無類別路由協定都支援手動路由彙總。其中有些協定預設會在主要網路邊界自動彙總為有類別網路位址。舉例來說,假設路由器 A 開啟了自動彙總功能,且它知道 10.1.0.0/24、10.1.1.0/24、10.1.2.0/24,一直到 10.1.255.0/24 的所有子網路。在這種情況下,路由器 A 會自動將 10.0.0.0/8 路由發送給任何位於其他主要網路的鄰居。
This automatic summarization of a classless routing protocol like EIGRP can be a problem if your subnets are discontiguous, meaning the 10.1.x.x subnets are separated from the 10.2.x.x subnets by a different classful network such as 172.16.0.0. To stop this from happening, automatic route summarization must be disabled with the no auto-summary command under EIGRP. The subnets could then be manually summarized with the /16 mask. Remember, the automatic summarization would not even occur if all subnets are in the 10.0.0.0 network.
如果你的子網路是不連續的,也就是 10.1.x.x 子網路與 10.2.x.x 子網路被另一個有類別網路(例如 172.16.0.0)隔開,那麼像 EIGRP 這類無類別路由協定的自動彙總就可能造成問題。若要避免這種情況,必須在 EIGRP 底下使用 no auto-summary 指令停用自動路由彙總。之後可以再用 /16 遮罩手動彙總這些子網路。請記住,如果所有子網路都在 10.0.0.0 網路內,那麼自動彙總根本不會發生。
OSPF does not know the concept of autosummarization; hence, you must manually summarize the routes that should be advertised to neighbor routers. Otherwise, all subnets will be sent separately and may result in large routing tables in the receiving routers. As of IOS release 15, EIGRP does not have autosummarization on by default. In older IOS versions autosummarization was on by default. EIGRP’s autosummarization feature can be disabled by using the no auto-summary command.
OSPF 沒有自動彙總的概念,因此你必須手動彙總要通告給鄰居路由器的路由。否則,所有子網路都會分別發送,可能導致接收端路由器的路由表變得龐大。從 IOS 15 版起,EIGRP 預設不會開啟自動彙總;在較舊的 IOS 版本中,自動彙總預設是開啟的。可以使用 no auto-summary 指令停用 EIGRP 的自動彙總功能。
Classful routing protocols do not support manual route summarization and perform only autosummarization.
有類別路由協定不支援手動路由彙總,只會執行自動彙總。

