首页 > 学院 > 网络通信 > 正文

Cisco IOS Cookbook 中文精简版第七章EIGRP

2019-11-05 00:10:01
字体:
来源:转载
供稿:网友

7.1.  配置EIGRP

提问 配置网络使用EIGRP路由协议

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#interface Ethernet0

Router1(config-if)#ip address 192.168.20.1 255.255.255.0

Router1(config-if)#exit

Router1(config)#interface Serial0.1 point-to-point

Router1(config-subif)#ip address 172.25.2.2 255.255.255.252

Router1(config-subif)#exit

Router1(config)#router eigrp 55

Router1(config-router)#network 172.25.0.0

Router1(config-router)#network 192.168.20.0

Router1(config-router)#exit

Router1(config)#end

Router1#

注释 要确保启用此路由协议的所有路由器配置的EIGRP后面的进程号相同,可以使用show ip eigrp neighbors 来验证邻居关系。同时支持network 192.168.20.0 0.0.0.255 来定义发布的网络

 

7.2.  路由过滤

提问 对EIGRP学到或者宣告的路由进行过滤

回答

入方向过滤

Router2#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router2(config)#access-list 34 deny 192.168.30.0

Router2(config)#access-list 34 permit any

Router2(config)#router eigrp 55

Router2(config-router)#distribute-list 34 in Serial0.1

Router2(config-router)#exit

Router2(config)#end

Router2#

出方向过滤

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#access-list 57 permit 172.25.1.0

Router1(config)#access-list 57 deny any


Router1(config)#router eigrp 55

Router1(config-router)#distribute-list 57 out Serial0/0.2

Router1(config-router)#exit

Router1(config)#end

Router1#

使用PRefix方式过滤,并且支持gateway 选项

Router9#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router9(config)#ip prefix-list ALLOWED-PREFIXES permit 10.0.0.0/8 le 32

Router9(config)#ip prefix-list ALLOWED-PREFIXES deny 0.0.0.0/0 le 32

Router9(config)#ip prefix-list ALLOWED-NEIGHBORS permit 172.18.19.1/32

Router9(config)#ip prefix-list ALLOWED-NEIGHBORS permit 172.18.19.4/32

Router9(config)#ip prefix-list ALLOWED-NEIGHBORS deny 0.0.0.0/0 le 32

Router9(config)#router eigrp 55

Router9(config-router)#distribute-list prefix ALLOWED-PREFIXES gateway ALLOWED-NEIGHBORS in

Router9(config-router)#exit

Router9(config)#end

Router9#

 

注释 在路由过滤时推荐使用prefix方式而不用ACL形式。Gateway参数只能用于入方向控制,同时建议不用和interface混和使用

7.3.  再发布路由到EIGRP 

提问 再发布其他方式学到的路由到EIGRP路由进程

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#router eigrp 55

Router1(config-router)#redistribute rip

Router1(config-router)#default-metric 1000 100 250 100 1500

Router1(config-router)#exit

Router1(config)#end

Router1#

注释 假如再发布的是静态路由可以不用配置default-metric命令,对于其他协议都必须配置此命令否则无法成功再发布。再发布之前也可以使用过滤列表进行路由过滤,从而只再发布特定路由

Router1(config)#router eigrp 55

Router1(config-router)#redistribute ospf 99

Router1(config-router)#distribute-list 7 out ospf 99


7.4.  使用Route Map方式来配置再发布

提问 使用控制粒度更好的Route Map方式来配置再发布

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip route 192.168.10.0 255.255.255.0 172.22.1.4

Router1(config)#ip route 192.168.11.0 255.255.255.0 172.22.1.4

Router1(config)#ip route 192.168.12.0 255.255.255.0 172.22.1.4

Router1(config)#access-list 20 permit 192.168.10.0

Router1(config)#access-list 21 permit 192.168.11.0

Router1(config)#route-map STATIC permit 10

Router1(config-route-map)#match ip address 20

Router1(config-route-map)#set metric 56 100 255 1 1500

Router1(config-route-map)#set tag 2

Router1(config-route-map)#exit

Router1(config)#route-map STATIC permit 20

Router1(config-route-map)#match ip address 21

Router1(config-route-map)#set metric 128 200 255 1 1500

Router1(config-route-map)#exit

Router1(config)#route-map STATIC deny 30

Router1(config-route-map)#exit

Router1(config)#router eigrp 55

Router1(config-router)#redistribute static route-map STATIC

Router1(config-router)#exit

Router1(config)#end

Router1#

注释 此处配置和前面6.3的配置差不多,唯一需要注重的就是前面提到的必须要加上metric的设置

7.5.  特定接口禁止EIGRP

提问 禁止某个端口参与EIGRP

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#router eigrp 55

Router1(config-router)#passive-interface Serial0/1

Router1(config-router)#exit

Router1(config)#end

Router1#

注释 这里的被动接口和RIP不同,由于结果是不能形成邻居在此接口所以使用该命令以后就不能发送也不能接收路由信息


7.6.  调整EIGRP度量值

提问 修改学到的EIGRP路由器度量值

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#access-list 22 permit 192.168.30.0

Router1(config)#access-list 33 permit 192.168.30.0

Router1(config)#router eigrp 55

Router1(config-router)#offset-list 33 out 10000 Serial0.1

Router1(config-router)#offset-list 22 in 10000 Serial0.1

Router1(config-router)#exit

Router1(config)#end

Router1#

 

注释

7.7.  定时器调整

提问 调整定时器优化收敛

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#interface Serial0.1

Router1(config-subif)#ip hello-interval eigrp 55 3

Router1(config-subif)#ip hold-time eigrp 55 9

Router1(config-subif)#exit

Router1(config)#end

Router1#

注释 EIGRP的一个特性就是定时器的调整可以基于端口,并且不用保持整个网络中所有设备的定时器设置一致,各个定时器都是独立的

7.8.  启用EIGRP认证

提问 增强路由信息安全性

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#key chain ORA

Router1(config-keychain)#key 1

Router1(config-keychain-key)#key-string oreilly

Router1(config-keychain-key)#exit

Router1(config-keychain)#exit

Router1(config)#interface Serial0/1

Router1(config-if)#ip authentication mode eigrp 55 md5

Router1(config-if)#ip authentication key-chain eigrp 55 ORA

Router1(config-if)#exit


Router1(config)#end

Router1#

注释 注重这里只是认证不是加密路由信息包。下面提供一种更改key方法,帮助网络平稳过渡到新的key

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#key chain Mars

Router1(config-keychain)#key 1

Router1(config-keychain-key)#key-string rocket

Router1(config-keychain-key)#accept-lifetime 00:00:00 Jan 1 1993 00:15:00 Nov 1 2006

Router1(config-keychain-key)#send-lifetime 00:00:00 Jan 1 1993 00:00:00 Nov 1 2006

Router1(config-keychain-key)#key 2

Router1(config-keychain-key)#key-string martian

Router1(config-keychain-key)#accept-lifetime 23:45:00 Oct 31 2006 infinite

Router1(config-keychain-key)#send-lifetime 00:00:00 Nov 1 2006 infinite 

Router1(config-keychain-key)#end

Router1#

7.9.  配置EIGRP路由汇总

提问 通过路由汇总来减少路由表大小和增强稳定性

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#interface Serial0/0.2

Router1(config-subif)#ip summary-address eigrp 55 172.25.0.0 255.255.0.0

Router1(config-subif)#exit

Router1(config)#end

Router1#

缺省会自动路由汇总,使用no auto-summary关闭(12.2(8)T后自动关闭)


同时可以配置汇总路由的同时,宣告部分子网路由

Router9# configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router9(config)#ip prefix-list 10.5.5/24 permit 10.5.5.0/24

Router9(config)#route-map LEAK10-5-5 permit 10

Router9(config-route-map)#match ip address prefix-list 10.5.5/24

Router9(config-route-map)#exit

Router9(config)#interface Serial0/0

Router9(config-if)#ip summary-address eigrp 55 10.5.0.0 255.255.0.0 leak-map LEAK10-5-5

Router9(config-if)#exit

Router9(config)#end

Router9#

注释 路由汇总也是EIGRP的特性之一,可以配置在任意路由器的接口进行汇总,不象OSPF那样只能在ABR汇总。汇总路由的度量值和所汇总路由中的最好的子网路由的度量值一致。Leakmap特性在12.3(14)T后引入,可以在汇总路由的同时发布某些更匹配的路由

7.10.  记录邻居状态变化

提问 记录邻居状态变化

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#router eigrp 55

Router1(config-router)#eigrp log-neighbor-changes

Router1(config-router)#exit

Router1(config)#end

Router1#

注释 缺省开启

<!--[if !supportLists]-->7.11.       <!--[endif]-->限制EIGRP路由更新占用带宽

提问 限制EIGRP路由更新占用带宽的百分比

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#interface Serial0.1

Router1(config-subif)#ip bandwidth-percent eigrp 55 40

Router1(config-subif)#exit

Router1(config)#end

Router1#

注释 这里的百分比可以大于100%,当我们人为的设定了某端口带宽用于计算度量值时

7.12.  EIGRP Stub路由

提问 向边缘网络发布较小的路由表

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#router eigrp 55


Router1(config-router)#eigrp stub

Router1(config-router)#exit

Router1(config)#end

Router1#

注释

7.13.  路由标签

提问 通过对特定路由进行标签,防止再分发时出现路由回环

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip route 0.0.0.0 0.0.0.0 172.25.1.1

Router1(config)#access-list 7 permit 0.0.0.0

Router1(config)#route-map TAGGING permit 10

Router1(config-route-map)#match ip address 7

Router1(config-route-map)#set tag 5

Router1(config-route-map)#exit

Router1(config)#router eigrp 55

Router1(config-router)#redistribute static route-map TAGGING

Router1(config-router)#exit

Router1(config)#end

Router1#

注释

<!--[if !supportLists]-->7.14.       <!--[endif]-->查看EIGRP状态

提问 查看状态命令

回答

Router1#show ip protocols

Router1#show ip route eigrp

Router1#show ip eigrp neighbors

Router1#show ip eigrp interfaces

Router9#show ip eigrp accounting

Router1#show ip eigrp topology

 

注释 12.3(14)T引入了show ip eigrp accounting

Router9#show ip eigrp accounting

IP-EIGRP accounting for AS(55)/ID(172.18.5.9)

Total Prefix Count: 50  States: A-Adjacency, P-Pending, D-Down

State Address/Source   Interface        Prefix   Restart  Restart/

                                        Count     Count   Reset(s)


 A    172.20.10.1      Se0/0                 1        0        0

 A    172.18.19.1      Fa0/0                39        0        0

 A    172.18.19.4      Fa0/0                 1        0        0

 A    172.18.19.6      Fa0/0                 6        0        0

Router9#

Router1#show ip eigrp topology

IP-EIGRP Topology Table for AS(55)/ID(172.25.25.1)

 

Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,

       r - reply Status, s - sia Status

 

P 0.0.0.0/0, 1 sUCcessors, FD is 28160, tag is 5

         via Rstatic (28160/0)

         via Summary (28160/0), Null0

P 10.2.2.0/24, 1 successors, FD is 156160

         via 172.22.1.4 (156160/128256), FastEthernet0/1

P 10.1.1.0/30, 1 successors, FD is 3845120

         via Connected, Serial0/1

P 192.168.10.0/24, 1 successors, FD is 28160, tag is 5

         via Rstatic (28160/0)

P 192.168.30.0/24, 1 successors, FD is 156160

         via 172.22.1.4 (156160/128256), FastEthernet0/1

P 192.168.20.0/24, 1 successors, FD is 2195456

         via 172.25.2.2 (2195456/281600), Serial0/0.2


P 172.25.25.6/32, 1 successors, FD is 156160

         via 172.25.1.7 (156160/128256), FastEthernet0/0.1

P 172.25.25.1/32, 1 successors, FD is 128256

         via Connected, Loopback0

P 172.25.25.2/32, 1 successors, FD is 2297856

         via 172.25.2.2 (2297856/128256), Serial0/0.2

P 172.25.1.0/24, 1 successors, FD is 28160

         via Connected, FastEthernet0/0.1

P 172.25.2.0/30, 1 successors, FD is 2169856

         via Connected, Serial0/0.2

P 172.22.1.0/24, 1 successors, FD is 28160

         via Connected, FastEthernet0/1

Router1#



发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表