天天看點

[Lab1]-EIGRP試驗

[Lab1]-EIGRP試驗

1- EIGRP試驗

EIGRP 是一個高效的路由協定,它的特點如下:

1. 通過發送和接收Hello 包來建立和維持鄰居關系,并交換路由資訊;

2. 采用多點傳播(224.0.0.10)或單點傳播進行路由更新;

3. EIGRP 的管理距離為90 或170;

4. 采用觸發更新,減少帶寬占用;

5. 支援可變長子網路遮罩 (VLSM),預設開啟自動彙總功能;

6. 支援IP、IPX、AppleTalk 等多種網絡層協定;

7. 對每一種網絡協定,EIGRP 都維持獨立的鄰居表、拓撲表和路由表;

8. EIGRP 使用Diffusing Update 算法(DUAL)來實作快速收斂.并確定沒有路由環路;

9. 存儲整個網絡拓撲結構的資訊,以便快速适應網絡變化;

10. 支援等價和非等價的負載均衡;

11. 使用可靠傳輸協定(RTP)保證路由資訊傳輸的可靠性;

12. 無縫連接配接資料鍊路層協定和拓撲結構,EIGRP 不要求對OSI 參考模型的2 層協定做

特别的配置。

1.1 eigrp 單點傳播更新

R1(f0/0) ----- (f0/1)R2

Eigrp不僅可以多點傳播路由更新也可以單點傳播路由更新,指令必須要在所有router上做

R1(config-router)#neighbor 12.1.1.2 f0/0 \\指令是在路由模式下敲入的    

R2(config-router)#neighbor 12.1.1.1 f0/1

但如果有passive-interface指令,無論單點傳播或者多點傳播都不能建立起鄰居

R2(config)#router eigrp 90

R2(config-router)#passive-interface default

R2(config-router)#no passive-interface f0/1

一般端口連接配接用戶端時可以使用passive interface

1.2 eigrp 認證

Eigrp預設隻支援md5認證,認證也必須是兩端同時做

R1/2(config-if)#ip authentication mode eigrp 90 md5 \\接口下做 開啟認證

R1/2(config-if)#ip authentication key-chain eigrp 90 fuyi/2 \\ 調用key-chain在eigrp認證上

R1(config)#key chain fuyi

R1(config-keychain)#key 0

R1(config-keychain-key)#key-string fuyiccna \\認證過程都是拿序列号最小的一個key去驗證(而且兩端都必須使用相同的key id [key 0]去驗證 ),不會去用key1 或者key2去往下去驗證 是以我們應該在r2配置如下

R2#sh run | se key chain

key chain fuyi2

key 0 \\

key-string fuyiccna

key 1

另外的 key 的配置下還可以接send –lifetime 和 accept –lifetime 去定義一個key的有效期

1.3 eigrp手工彙總

拓撲圖: R1(e0/0)----(e0/1)R2(e0/0)----(e0/1)R3

R1#sh ip int b

Interface IP-Address OK? Method Status Protocol

Ethernet0/0 12.1.1.1 YES manual up up

Loopback0 192.168.0.1 YES manual up up

Loopback1 192.168.1.1 YES manual up up

Loopback2 192.168.2.1 YES manual up up

Loopback3 192.168.3.1 YES manual up up

全網跑 eigrp

情形一:

如果在r1 eigrp宣告時,net 192.168.0.0 0.0.255.255

那麼看 r3上的路由表

R3#sh ip rout eigrp

D 192.168.0.0/24 [90/435200] via 23.1.1.2, 00:01:57, Ethernet0/1

12.0.0.0/24 is subnetted, 1 subnets

D 12.1.1.0 [90/307200] via 23.1.1.2, 00:02:45, Ethernet0/1

D 192.168.1.0/24 [90/435200] via 23.1.1.2, 00:01:57, Ethernet0/1

D 192.168.2.0/24 [90/435200] via 23.1.1.2, 00:01:57, Ethernet0/1

D 192.168.3.0/24 [90/435200] via 23.1.1.2, 00:01:57, Ethernet0/1

說明network是R1把直接路由在 192.168.0.0/16内的路由資訊宣告出去了

情形二: 在情形1的條件下,在R1(或者R2上)加: eigrp 彙總路由

R1(config-if)#ip summary-address eigrp 90 192.168.0.0 255.255.252.0

R3#sh ip rout eigrp

D 12.1.1.0 [90/307200] via 23.1.1.2, 00:08:54, Ethernet0/1

D 192.168.0.0/22 [90/435200] via 23.1.1.2, 00:00:18, Ethernet0/1

說明手工彙總抑制了明晰路由,産生了一條192.168.0.0/22的路由

同時産生D 192.168.0.0/22 is a summary, 00:02:49, Null0 防止路由環路

那麼就說明在R1 敲network 192.168.0.0/16 已不生效

另: 這個問題應該是那個老兄上課時 要的問得問題的答案吧J

1.4 eigrp注入預設路由

[Lab1]-EIGRP試驗

3.3.3.3是internet

1.4.1 重分布方法

把靜态路由重分布進eigrp

R2(config)#ip route 0.0.0.0 0.0.0.0 s1/0

R2(config)#router ei 90

R2(config-router)#redistribute static

[Lab1]-EIGRP試驗
1.4.2 宣告全零法

在r2寫一條指向端口的靜态路由 (指下一跳無效,以前的blog有解釋過原因),在eigrp上用network 0.0.0.0宣告

<結果不展示,結果跟上一個方法一樣>

1.4.3 使用ip default-network

使用這個指令的條件:

注意為了能看到試驗效果,務必不要使用network 0.0.0.0 去宣告路由

[Lab1]-EIGRP試驗

R2 上配置如下

ip default-network 3.0.0.0

ip route 3.0.0.0 255.0.0.0 Serial1/0

R2#sh run | se router ei

router eigrp 90

network 3.0.0.0

network 12.0.0.0

no auto-summary

[Lab1]-EIGRP試驗

1.5 eigrp負載均衡

拓撲圖

[Lab1]-EIGRP試驗
1.5.1等價負載均衡

預設eigrp是開啟等價負載均衡,因為 variance的值為1

EIGRP maximum metric variance 1

為了友善算metric值我們用指令修改該K值

R1/2/3/4(config-if)#router eig 90

R1/2/3/4 (config-router)#metric weight 0 0 0 1 0 0

預設metric計算公式:metric= [10^7 /bandwidth (min) + delay(sum)/10] * 256

在R1上看3.3.3.3的路由表

D 3.3.3.0 [90/665600] via 14.1.1.4, 00:00:58, FastEthernet0/1

[90/665600] via 12.1.1.2, 00:00:58, FastEthernet0/0

下面我們來計算下665600是怎麼來的?

Show inter f0/0 s1/0 lo0

可以看到個個接口的延遲 那麼我們把這些接口的延遲加起來

metric計算的方向為路由進接口的方向 (interface in 方向 )

6656600 = (20000 + 1000 + 5000 )/10 * 256

1.5.2 非等價負載均衡

如何開啟負載均衡?

首先負載均衡是發生在 s 與 fs 之間,是以開啟它的條件為:

1 AD < (S)FD ===>也是成為fs的條件

2 FS FD < S FD * V 值

我們先把R2的延遲改高些,R4的延遲改低一些

R2(config)#int s1/0

R2(config-if)#delay 15 (實際上為150 微妙 ,10倍的倍數關系)

R4 (config-if)#delay 10

同時在R1上讓v值不等于1

R1(config)#router ei 90

R1(config-router)#variance 2

在R1上看拓撲表

R1#sh ip eigrp topology

P 3.3.3.0/24, 1 successors, FD is 156160

via 14.1.1.4 (156160/130560), FastEthernet0/1

via 12.1.1.2 (157440/131840), FastEthernet0/0

條件1:131840 < 156160 符合成為fs的條件

條件2: FD(主)*variance >FD(備份)時

156160 * 2 > 157440

Show ip route可以檢視結果

1.6 eigrp的路由過濾

試驗要求:用上圖的試驗拓撲圖,全網跑 eigrp

在r1 開三個lookback 口 , 位址分别是 1.1.1.1 10.1.1.1 100.1.1.1

[Lab1]-EIGRP試驗

要求 R3 隻可以看到100.1.1.1

答案 :使用distribute-list

在r3上使用access-list ,然後再eigrp協定模式中使用distribute-list

R3#sh ip access-lists

Standard IP access list 10

10 deny 1.1.1.0, wildcard bits 0.0.0.255 (4 matches)

20 deny 10.1.1.0, wildcard bits 0.0.0.255 (4 matches)

30 permit any (6 matches)

R3(config)#router ei 90

R3(config-router)#distribute-list 10 in

試驗結果如下:

[Lab1]-EIGRP試驗

1.7 offset-list 在 eigrp中的使用

接上圖試驗,我們使從23.1.1.2過來的100.1.1.0的路由的metric的值瞬間增加改為600000

指令:

Standard IP access list 20

10 permit 100.1.1.0, wildcard bits 0.0.0.255 (4 matches)

R3(config-router)# offset-list 20 in 600000 Serial1/0

再次檢視r3的路由表,發現metric 變為1265600 ( 665600+600000)

D 100.1.1.0 [90/1265600] via 23.1.1.2, 00:00:24, Serial1/0

1.8 eigrp stub

Eigrp stub是避免sia的一個比較好的方式,因為它可以限制查詢範圍

拓撲圖如下:

[Lab1]-EIGRP試驗

把 r1的lo 0口關閉,debug eigrp packages 可以看到, r1會向r2查詢1.1.1.0的路由 query封包

*Mar 1 07:49:08.142: EIGRP: Sending QUERY on FastEthernet0/0

在r2 上敲入

R2(config)#router eig 90

R2(config-router)#eigrp stub

Mar 1 07:53:06.606: EIGRP: Received QUERY on FastEthernet0/0 nbr 12.1.1.2 《r1隻會收到r2的query封包,r1 是不會向r2發送query封包的》

當然r3上也不會有1.1.1.0 這個網段的路由

然而當我們在r1的lo 0口下 no shut後 R3 永遠學不到1.1.1.0的路由 原因如下 :

預設情況下 stub router隻會傳直鍊和彙總的路由

那麼要透露出1.1.1.0解決辦法是什麼?

我們可以使用leak-map

Step1 : access-list

R2#sh ip access-lists

10 permit 1.1.1.0, wildcard bits 0.0.0.255

Step2 : route-map

R2(config)#route-map fuyi

R2(config-route-map)#match ip address fuyi

R2(config-route-map)#exit

Step3: 調用route-map

R2(config-router)#eigrp stub leak-map fuyi

試驗結果

[Lab1]-EIGRP試驗

1.9 EIGRP 常用指令

show ip eigrp neighbors 檢視EIGRP 鄰居表

show ip eigrp topology 檢視EIGRP 拓撲結構資料庫

show ip eigrp interface 檢視運作EIGRP 路由協定的接口的狀況

show ip eigrp traffic 檢視EIGRP 發送和接收到的資料包的統計情況

debug eigrp neighbors 檢視EIGRP 動态建立鄰居關系的情況

debug eigrp packets 顯示發送和接收的EIGRP 資料包

ip hello-interval eigrp 配置EIGRP 的HELLO 發送周期

ip hold-time eigrp 配置EIGRP 的HELLO hold 時間

router eigrp 啟動EIGRP 路由程序

no auto-summary 關閉自動彙總

ip authentication mode eigrp 配置EIGRP 的認證模式

ip authentication key-chain eigrp 在接口上調用鑰匙鍊

variance 配置非等價負載均衡

delay 配置接口下的延遲