EIGRP(Enhanced Interior Gateway Routing Protocol)是由思科開發的一種高級距離矢量路由協議,結合了距離矢量和鏈路狀態路由協議的優點;EIGRP具有快速收斂、高效帶寬利用、負載均衡等特點,適用于各種規模的網絡。EIGRP長期以來一直是思科專有的路由協議,這意味著 EIGRP只能在思科的網絡設備上運行。然而,自從 2013 年起,思科將 EIGRP 的某些部分作為開放標準進行了發布,使得其他廠商也能夠實現 EIGRP。雖然 EIGRP 現在已經開放給其他廠商使用,但其最廣泛和最完整的實現仍然在思科設備上。在混合環境或非思科設備環境中,使用 OSPF 或 BGP 這樣的標準協議可能會更為合適和便捷。
EIGRP工作原理
EIGRP工作原理包括鄰居發現、路由更新、度量值計算、路徑選擇和快速收斂等方面。
-
鄰居發現和維護:EIGRP 使用 Hello 報文在相鄰路由器之間建立和維護鄰居關系。
Hello 報文:EIGRP 路由器定期發送 Hello 報文來發現和確認鄰居。
Hold Timer:如果在 Hold 時間內沒有收到鄰居的 Hello 報文,路由器會認為該鄰居失效,并將其從鄰居表中移除。
-
路由更新:EIGRP 采用部分更新機制,只在網絡拓撲發生變化時發送更新,減少了帶寬的使用。
觸發更新:當一個路由器檢測到網絡拓撲發生變化時,會立即發送更新,而不是等待定期更新。
-
度量值計算:EIGRP 使用復合度量值來選擇最佳路徑。度量值包括帶寬、延遲、負載、可靠性和 MTU 等多個因素。
帶寬(Bandwidth):路徑上最低帶寬的逆數。 延遲(Delay):路徑上所有鏈路的延遲之和。 負載(Load):路徑上鏈路的當前負載。 可靠性(Reliability):路徑上鏈路的可靠性。 MTU(Maximum Transmission Unit):路徑上鏈路的最大傳輸單元(通常不直接影響度量值)。
復合度量值公式:
其中 K1,K2,K3,K4,K5 是用戶可配置的權重參數,默認值通常為 K1=1,K3=1K_1 = 1, K_3 = 1K1=1,K3=1,其余為 0。
-
路徑選擇&快速收斂:EIGRP 使用 DUAL(Diffusing Update Algorithm)算法來保證無環路的最佳路徑選擇和快速收斂。
Feasible Distance(FD):到達目標網絡的最低度量值(路由器本身的度量值 + 報告距離)。 Reported Distance(RD):鄰居路由器報告的到達目標網絡的度量值。 Successor:到達目標網絡的最佳路徑。 Feasible Successor:備選路徑,其報告距離小于當前路徑的可行距離。
EIGRP 的 DUAL 算法使其能夠在網絡拓撲變化時快速收斂,減少網絡中斷時間;通過 Feasible Successor 路徑,可以迅速替換失效的 Successor 路徑,而無需重新計算所有路徑。
EIGRP 的關鍵報文類型
Hello 報文:用于鄰居發現和維護。 更新報文(Update):發送路由信息更新。 查詢報文(Query):當沒有可行的 Successor 時,用于詢問鄰居路由器。 回復報文(Reply):響應查詢報文。 確認報文(ACK):確認收到可靠傳輸的報文(Update、Query 和 Reply)。
EIGRP的配置
EIGRP(Enhanced Interior Gateway Routing Protocol)的配置包括啟用 EIGRP 進程、定義要參與 EIGRP 的網絡、配置度量值、進行路由匯總、設置重分布等。下面我們通過一個詳細的配置示例,逐步介紹如何在路由器上配置 EIGRP。
基本配置步驟
①啟用 EIGRP 路由協議 ②定義參與 EIGRP 的網絡 ③配置接口和度量值 ④進行路由匯總(可選) ⑤進行路由重分布(可選)
假設我們有如下拓撲:
? +--------+ ? ? ? ? +--------+| Router | ? ? ? ? | Router || ? R1 ? |---------| ? R2 ? |+--------+ ? ? ? ? +--------+
R1 與 R2 通過網絡 192.168.1.0/24 互連;R1 還有一個內部網絡 10.1.1.0/24;R2 還有一個內部網絡 172.16.1.0/24。
在 R1 上配置 EIGRP
配置接口 IP 地址
R1(config)# interface GigabitEthernet0/0
R1(config-if)# ip address 192.168.1.1 255.255.255.0
R1(config-if)# no shutdown
?
R1(config)# interface GigabitEthernet0/1
R1(config-if)# ip address 10.1.1.1 255.255.255.0
R1(config-if)# no shutdown
啟用 EIGRP 進程
R1(config)# router eigrp 1
R1(config-router)# network 192.168.1.0 0.0.0.255
R1(config-router)# network 10.1.1.0 0.0.0.255
R1(config-router)# no auto-summary
在 R2 上配置 EIGRP
配置接口 IP 地址
R2(config)# interface GigabitEthernet0/0
R2(config-if)# ip address 192.168.1.2 255.255.255.0
R2(config-if)# no shutdown
?R2(config)# interface GigabitEthernet0/1
R2(config-if)# ip address 172.16.1.1 255.255.255.0
R2(config-if)# no shutdown
啟用 EIGRP 進程
R2(config)# router eigrp 1 進入自治系統號為1的EIGRP進程。注意:這個1是自治系統號不是進程號,具有全局意義,就是在一個園區內,自治系統號,需要一樣。
R2(config-router)# network 192.168.1.0 0.0.0.255
R2(config-router)# network 172.16.1.0 0.0.0.255
R2(config-router)# no auto-summary
路由匯總和重分布【可選】
路由匯總:EIGRP 支持自動和手動路由匯總,以減少路由表的規模和復雜度。
1. 自動路由匯總
EIGRP 的自動匯總功能會在主類邊界上進行路由匯總。這意味著如果 EIGRP 路由器的接口在不同的主類網絡上,它會將這些網絡匯總為主類網絡。例如,如果一個路由器有兩個接口,一個在 192.168.1.0/24 網絡,另一個在 192.168.2.0/24 網絡,EIGRP 會將它們匯總為 192.168.0.0/16。
①配置自動匯總:
Router(config)# router eigrp 1
Router(config-router)# auto-summary
②禁用自動匯總:
在一些情況下,自動匯總可能會導致不期望的結果,因此可以禁用它。
Router(config)# router eigrp 1
Router(config-router)# no auto-summary //禁用自動匯總
2.手動路由匯總
手動匯總允許管理員在路由器的特定接口上配置匯總地址。這種方法提供了更大的靈活性和控制,可以根據網絡設計的需求進行定制。
配置手動匯總: 假設我們有一個路由器,其 EIGRP 進程為 1,并且希望在接口 GigabitEthernet0/1
上進行路由匯總。網絡 10.1.0.0/24 到 10.1.3.0/24 可以匯總為 10.1.0.0/22。
Router(config)# interface GigabitEthernet0/1
Router(config-if)# ip summary-address eigrp 1 10.1.0.0 255.255.252.0
路由重分布:EIGRP 支持與其他路由協議(如 OSPF、RIP 等)之間的路由重分布,使得不同協議間的路由信息可以互相傳遞和使用。
路由重分布的基本概念
源協議(Source Protocol):重分布的路由信息來自的路由協議。 目標協議(Target Protocol):重分布的路由信息將被引入的路由協議。 度量值(Metric):重分布的路由需要設置初始度量值,以便目標協議能夠正確計算路徑。
路由重分布的步驟
識別需要重分布的路由協議:確定哪些路由協議之間需要進行重分布。 配置重分布命令:在目標協議中配置重分布命令,將源協議的路由信息引入。 設置度量值:為重分布的路由設置合適的度量值。 應用過濾器(可選):使用路由映射或訪問控制列表(ACL)來控制重分布的路由,以防止不必要的路由傳播。
配置 EIGRP 路由重分布的示例:
多協議網絡中,路由重分布可以實現不同路由協議之間的互通。我們將通過一個詳細的示例,說明如何在 EIGRP 和 OSPF 之間進行路由重分布。假設我們有以下網絡拓撲:
-
路由器 R1 運行 OSPF 和 EIGRP 協議。
-
路由器 R2 僅運行 EIGRP 協議。
-
路由器 R3 僅運行 OSPF 協議。
? +--------+ ? ? ? ? +--------+ ? ? ? ? +--------+| Router | ? ? ? ? | Router | ? ? ? ? | Router || ? R1 ? |---------| ? R2 ? |---------| ? R3 ? |+--------+ ? ? ? ? +--------+ ? ? ? ? +--------+OSPF & EIGRP ? ? ? EIGRP only ? ? ? ? OSPF only
配置目標
-
將 OSPF 的路由信息重分布到 EIGRP 中。
-
將 EIGRP 的路由信息重分布到 OSPF 中。
詳細配置步驟
1. 配置基礎網絡
首先,確保在 R1、R2 和 R3 上配置好基礎的 EIGRP 和 OSPF 網絡。
在 R1 上配置 EIGRP 和 OSPF
R1(config)# interface GigabitEthernet0/0
R1(config-if)# ip address 192.168.1.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# exit
?
R1(config)# interface GigabitEthernet0/1
R1(config-if)# ip address 10.1.1.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# exit
?
R1(config)# router eigrp 1
R1(config-router)# network 192.168.1.0 0.0.0.255
R1(config-router)# network 10.1.1.0 0.0.0.255
R1(config-router)# no auto-summary
R1(config-router)# exit
?
R1(config)# router ospf 1
R1(config-router)# network 10.1.1.0 0.0.0.255 area 0
R1(config-router)# exit
在 R2 上配置 EIGRP
R2(config)# interface GigabitEthernet0/0
R2(config-if)# ip address 192.168.1.2 255.255.255.0
R2(config-if)# no shutdown
R2(config-if)# exit
?
R2(config)# interface GigabitEthernet0/1
R2(config-if)# ip address 192.168.2.1 255.255.255.0
R2(config-if)# no shutdown
R2(config-if)# exit
?
R2(config)# router eigrp 1
R2(config-router)# network 192.168.1.0 0.0.0.255
R2(config-router)# network 192.168.2.0 0.0.0.255
R2(config-router)# no auto-summary
R2(config-router)# exit
在 R3 上配置 OSPF
R3(config)# interface GigabitEthernet0/0
R3(config-if)# ip address 192.168.2.2 255.255.255.0
R3(config-if)# no shutdown
R3(config-if)# exit
?
R3(config)# router ospf 1
R3(config-router)# network 192.168.2.0 0.0.0.255 area 0
R3(config-router)# exit
2. 配置路由重分布
在 R1 上將 OSPF 的路由重分布到 EIGRP 中
R1(config)# router eigrp 1
R1(config-router)# redistribute ospf 1 metric 10000 100 255 1 1500
在這條命令中:
-
redistribute ospf 1
:表示將 OSPF 進程 1 的路由重分布到 EIGRP。 -
metric 10000 100 255 1 1500
:設置重分布路由的 EIGRP 度量值,其中10000
是帶寬,100
是延遲,255
是可靠性,1
是負載,1500
是 MTU。
在 R1 上將 EIGRP 的路由重分布到 OSPF 中
R1(config)# router ospf 1 R1(config-router)# redistribute eigrp 1 subnets
在這條命令中:
-
redistribute eigrp 1
:表示將 EIGRP 進程 1 的路由重分布到 OSPF。 -
subnets
:關鍵字確保包括子網信息。
3. 路由過濾(可選)
為了精細控制重分布的路由,可以使用路由映射進行過濾。
創建路由映射和訪問控制列表
假設我們只希望將 192.168.1.0/24 和 192.168.2.0/24 網絡重分布到 OSPF 中。
R1(config)# access-list 10 permit 192.168.1.0 0.0.0.255
R1(config)# access-list 10 permit 192.168.2.0 0.0.0.255
?
R1(config)# route-map EIGRP_TO_OSPF permit 10
R1(config-route-map)# match ip address 10
?
R1(config)# router ospf 1
R1(config-router)# redistribute eigrp 1 subnets route-map EIGRP_TO_OSPF
在這條命令中:
-
access-list 10
定義了允許的網絡。 -
route-map EIGRP_TO_OSPF
定義了一個路由映射,匹配 ACL 10 中定義的網絡。 -
redistribute eigrp 1 subnets route-map EIGRP_TO_OSPF
使用路由映射進行重分布。
通過以上配置,我們實現了 EIGRP 和 OSPF 之間的路由重分布。R1 會將 OSPF 的路由信息引入 EIGRP,同時將 EIGRP 的路由信息引入 OSPF。使用路由映射和訪問控制列表,我們可以更精細地控制重分布的路由,確保網絡的穩定和高效運行。
驗證配置
在 R1 上查看 EIGRP 鄰居關系
R1# show ip eigrp neighbors
EIGRP(Enhanced Interior Gateway Routing Protocol)的配置包括啟用 EIGRP 進程、定義要參與 EIGRP 的網絡、配置度量值、進行路由匯總、設置重分布等。下面我們通過一個詳細的配置示例,逐步介紹如何在路由器上配置 EIGRP。
基本配置步驟
-
啟用 EIGRP 路由協議
-
定義參與 EIGRP 的網絡
-
配置接口和度量值
-
進行路由匯總(可選)
-
進行路由重分布(可選)
配置示例
假設我們有如下拓撲:
+--------+ ? ? ? ? +--------+| Router | ? ? ? ? | Router || ? R1 ? |---------| ? R2 ? |+--------+ ? ? ? ? +--------+
-
R1 與 R2 通過網絡 192.168.1.0/24 互連。
-
R1 還有一個內部網絡 10.1.1.0/24。
-
R2 還有一個內部網絡 172.16.1.0/24。
在 R1 上配置 EIGRP
配置接口 IP 地址
shell復制代碼R1(config)# interface GigabitEthernet0/0
R1(config-if)# ip address 192.168.1.1 255.255.255.0
R1(config-if)# no shutdown
?
R1(config)# interface GigabitEthernet0/1
R1(config-if)# ip address 10.1.1.1 255.255.255.0
R1(config-if)# no shutdown
啟用 EIGRP 進程
R1(config)# router eigrp 1
R1(config-router)# network 192.168.1.0 0.0.0.255
R1(config-router)# network 10.1.1.0 0.0.0.255
R1(config-router)# no auto-summary
在上述命令中:
-
router eigrp 1
:啟動 EIGRP 進程 。 -
network 192.168.1.0 0.0.0.255
和network 10.1.1.0 0.0.0.255
:指定要參與 EIGRP 的網絡。 -
no auto-summary
:禁用自動匯總。
在 R2 上配置 EIGRP
配置接口 IP 地址
shell復制代碼R2(config)# interface GigabitEthernet0/0
R2(config-if)# ip address 192.168.1.2 255.255.255.0
R2(config-if)# no shutdown
?
R2(config)# interface GigabitEthernet0/1
R2(config-if)# ip address 172.16.1.1 255.255.255.0
R2(config-if)# no shutdown
啟用 EIGRP 進程
R2(config)# router eigrp 1
R2(config-router)# network 192.168.1.0 0.0.0.255
R2(config-router)# network 172.16.1.0 0.0.0.255
R2(config-router)# no auto-summary
路由匯總配置(可選)
假設我們要在 R1 上對 10.1.1.0/24 網絡進行匯總。
R1(config)# interface GigabitEthernet0/1
R1(config-if)# ip summary-address eigrp 1 10.1.0.0 255.255.0.0
在上述命令中:
-
ip summary-address eigrp 1 10.1.0.0 255.255.0.0
:在接口GigabitEthernet0/1
上對 10.1.0.0/16 進行匯總。
路由重分布配置(可選)
假設我們要在 R1 上將 OSPF 的路由信息重分布到 EIGRP 中,并將 EIGRP 的路由信息重分布到 OSPF 中。
將 OSPF 的路由重分布到 EIGRP 中
R1(config)# router eigrp 1
R1(config-router)# redistribute ospf 1 metric 10000 100 255 1 1500
將 EIGRP 的路由重分布到 OSPF 中
R1(config)# router ospf 1
R1(config-router)# redistribute eigrp 1 subnets
驗證配置
在 R1 上查看 EIGRP 鄰居關系
R1# show ip eigrp neighbors
在 R1 上查看 EIGRP 路由表
R1# show ip route eigrp
在 R1 上查看 EIGRP 拓撲表
R1# show ip eigrp topology