一 EIGRP基本配置
router eigrp
AS号
network
参与EIGRP的网络[反掩码]
R3(config-router)#network 3.3.3.0
R3(config-router)#network 3.33.33.0
在show run 中可以看到 变成了network 3.0.0.0
因此如果不加反掩码可以直接宣告主类网络,如果分开宣告,路由器也会合并.
所以还是加反掩码,能更好的控制每个接口宣告的路由条目.
二 EIGRP默认路由
方法1(宣告默认网络)
ip default-network 宣告的网络
1.首先要把默认路由的网络(出接口)宣告进eigrp AS中,如 network 192.168.0.0 0.0.0.255
2.ip default-network 192.168.0.0(
必须写成主类网络)
3.宣告默认静态路由 如 ip route 0.0.0.0 0.0.0.0 192.168.0.1
方法2(宣告所有网络) network 0.0.0.0
R1(config)#ip route 0.0.0.0 0.0.0.0 f0/0(
写下一跳不行,必须写接口)
还没有弄明白为什么
R1(config)#router eigrp 100
R1(config-router)#network 0.0.0.0
方法3(发布静态路由) Redistribute Static:
R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.0.1
R1(config)#router eigrp 100
R1(config-router)#redistribute static
可以看到
D*EX 0.0.0.0/0 [170/2684416] via 23.0.0.2, 00:00:30, Serial1/1
R3(config-router)#do ping 202.103.227.68
Sending 5, 100-byte ICMP Echos to 202.103.227.68, timeout is 2 seconds:
...!!
方法4 (路由汇总)ip summary-address eigrp 100 0.0.0.0 0.0.0.0 *自创,反向运用路由汇总
ip route 0.0.0.0 0.0.0.0 192.168.0.1
R1(config-if)#ip summary-address eigrp 100 0.0.0.0 0.0.0.0(
入接口s1/0)
在R1 s1/0上做汇总也就是把0.0.0.0网络汇总宣告给内部网络,所以R2,R3,R4,R6都可以收到这条汇总路由.
R5不能收到 s1/0的汇总,除非再做一条s1/2的
三 EIGRP路由汇总
1.自动汇总
R3(config-router)# auto-summary //边界上自动汇总,而且是
汇总成主类网络.所以一启动EIGRP就最好把自动汇总关闭,不然碰到不连续子网就出问题.
2.手动汇总
1.汇总原则:a、本地必须有明细路由,才会从做汇总的接口发出汇总路由。b、直到明细的最后一条路由消失,汇总才会消失。c、汇总路由的metric值会取最小的metric值
2.在接口上做
3.命令:
ip summary-address eigrp 100 10.0.0.0 255.255.252.0
4.注意: 汇总尽量做到最优,也就是汇总路由尽量汇总完所有子网,最好不要超出范围.
实践: R5的loopback0-4分别是10.0.0.1-10.0.4.1/24 一共有5个子网,用22位的掩码刚好可以汇总前4个子网.从24位开始,借几位就是2的几次方个子网.
如果掩码的位数不会算,那就一个一个试,
首先把10.0.0.0的网络全部宣告,用network 0.0.0.0也挺好偷懒的
比如从23位开始
R5(config-if)# ip summary-address eigrp 100 10.0.0.0 255.255.254.0
然后在R1上看结果
D 10.0.2.0/24 [90/2297856] via 15.0.0.5, 00:00:23, Serial1/2
D 10.0.3.0/24 [90/2297856] via 15.0.0.5, 00:00:23, Serial1/2
D 10.0.0.0/23 [90/2297856] via 15.0.0.5, 00:00:04, Serial1/2
D 10.0.4.0/24 [90/2297856] via 15.0.0.5, 00:08:18, Serial1/2
很明显23位掩码,汇总了10.0.0.0和10.0.1.0网段,因为不见了
再试试22位掩码
R5(config-if)# ip summary-address eigrp 100 10.0.0.0 255.255.252.0
R1显示
D 10.0.0.0/22 [90/2297856] via 15.0.0.5, 00:00:09, Serial1/2
D 10.0.4.0/24 [90/2297856] via 15.0.0.5, 00:12:53, Serial1/2
0,1,2,3的网络都被
10.0.0.0/22汇总取代
OK,不会算就直接配置来测试吧,让路由器算去,反正它CPU闲着也是闲着
插播一下:
(一)R5上会有一条
D 10.0.0.0/22 is a summary, 00:05:51, Null0
指向空接口,就当是垃圾桶.
这个设计很好:如果数据包经汇总路由发过来,找不到明细路由时,就直接丢弃.
所以路由汇总的优点也就出来了:1.可以提高网络的稳定性,2.降低路由器内存CPU占用.
(二)关于EIGRP手动汇总管理距离(AD)为5的查看,只有在本地上查看汇总路由的AD才为5,本例是在R5上
R5#
sh ip route 10.0.0.0 255.255.252.0
Routing entry for 10.0.0.0/22
Known via "eigrp 100",
distance 5, metric 128256, type internal
Redistributing via eigrp 100
Routing Descriptor Blocks:
* directly connected, via Null0
Route metric is 128256, traffic share count is 1
Total delay is 5000 microseconds, minimum bandwidth is 10000000 Kbit
Reliability 255/255, minimum MTU 1514 bytes
Loading 1/255, Hops 0
R1的
R1#sh ip route 10.0.0.0 255.255.252.0
Routing entry for 10.0.0.0/22
Known via "eigrp 100",
distance 90, metric 2297856, type internal
Redistributing via eigrp 100
Last update from 15.0.0.5 on Serial1/2, 00:13:48 ago
Routing Descriptor Blocks:
* 15.0.0.5, from 15.0.0.5, 00:13:48 ago, via Serial1/2
Route metric is 2297856, traffic share count is 1
Total delay is 25000 microseconds, minimum bandwidth is 1544 Kbit
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 1
四 EIGRP负载均衡
(一)等价负载均衡
*把路径metric值修改成一样就可以人为实现等价负载均衡了.
查看:R1#
show ip protocols
设置负载均衡的最大路径数(默认4条)
R1(config)#router eigrp 90
R1(config-router)#
maximum-paths 6(最多16条)
(二)不等价负载均衡
R1(config-if)#no ip route-cache
R1(config-if)#no ip cef
R1(config)#router ei 100
R1(config-router)#variance 2
注:我只在其中一个接口打命令进去,负载均衡就已经打开了...
查看结果:
R1#
sh ip route 36.0.0.0 255.255.255.0
Routing entry for 36.0.0.0/24
Known via "eigrp 100", distance 90, metric 3193856, type internal
Redistributing via eigrp 100
Last update from 14.0.0.4 on Serial1/3, 00:00:05 ago
Routing Descriptor Blocks:
14.0.0.4, from 14.0.0.4, 00:00:05 ago, via Serial1/3
Route metric is 3242496,
traffic share count is 59
Total delay is 60000 microseconds, minimum bandwidth is 1500 Kbit
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 2
* 12.0.0.2, from 12.0.0.2, 00:00:05 ago, via Serial1/0
Route metric is 3193856,
traffic share count is 60
Total delay is 60000 microseconds, minimum bandwidth is 1544 Kbit
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 2
测试:
1.show ip route
D 36.0.0.0 [90/3242496] via 14.0.0.4, 00:11:21, Serial1/3
[90/3193856] via 12.0.0.2, 00:11:21, Serial1/0
已经显示两条不等价的路径.
2.可以用扩展ping测试,开debug ip icmp
R1#ping
Protocol [ip]:
Target IP address: 36.0.0.6
Repeat count [5]: 60
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface:
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 60, 100-byte ICMP Echos to 36.0.0.6, timeout is 2 seconds:
!!!!!!!!!!!!! (部分内容)
*Mar 1 10:48:44.533: ICMP: echo reply rcvd, src 36.0.0.6, dst 12.0.0.1
*Mar 1 10:48:44.633: ICMP: echo reply rcvd, src 36.0.0.6, dst 12.0.0.1
*Mar 1 10:48:45.321: ICMP: echo reply rcvd, src 36.0.0.6, dst 12.0.0.1
*Mar 1 10:48:45.457: ICMP: echo reply rcvd, src 36.0.0.6, dst 12.0.0.1
*Mar 1 10:48:45.617: ICMP: echo reply rcvd, src 36.0.0.6, dst 14.0.0.1
*Mar 1 10:48:45.729: ICMP: echo reply rcvd, src 36.0.0.6, dst 14.0.0.1
*Mar 1 10:48:45.961: ICMP: echo reply rcvd, src 36.0.0.6, dst 14.0.0.1
五 EIGRP认证
*EIGRP只支持MD5认证
(一)配置
R2(config)#key chain mykc //
配置一个keychain名字
R2(config-keychain)#key 1 //
配置名字为mykc的keyID
R2(config-keychain-key)#key-string cisco //
配置该名字下该ID下的密码
R2(config-keychain-key)#int s1/0
R2(config-if)#ip authentication key-chain eigrp 100 mykc //
将认证密码应用到接口下
R2(config-if)#ip authentication mode eigrp 100 md5 //
启用MD5加密方式
发送,接收key时间设定
R1(config-keychain)#key 2
R1(config-keychain-key)#key-string cisco
R1(config-keychain-key)#
send-lifetime 00:00:00 may 1 2010 infinite //到2010年才发key2 ,
infinite无限(没有终止日期)
这条做了实验,如果存在key2 key3 对端只认证key3的话,就用上面这条命令让key2停发,认证就通过了.
还有一个
accept-lifetime应该也差不多吧.
(二)实验结果
1.keychain可以不同
2.KeyID要相同(除非用send-lifetime和accept-lifetime阻止不同的KeyID发送)
3.配置多个KeyID时,多个KeyID都要相同,否则可能只建立单向邻居,无法交换路由表.
(三)排错
(config)#debug eigrp packets
*Mar 1 12:00:28.789: EIGRP: pkt authentication key id = 1, key not defined or not live
*Mar 1 12:00:28.793: EIGRP: Serial1/0: ignored packet from 12.0.0.1, opcode = 1 (invalid authentication)
这个是单向邻居的情况,因为key id = 1 的key不存在,所以认证不通过,建立不了双向邻居.