实验中所用到的IOS请到 http://www.esnips.com/web/MYIOS 下载。
拓扑图如下:
4-5 EIGRP非等价负载均衡.jpg (33.92 KB)
2007-4-4 08:18


net文件如下:
autostart = False
[localhost]
    port = 7200
    udp = 10000
    workingdir = ..\workingdir
    `2610`
         p_w_picpath = J:\c2600-i-mz.113-4.t1.bin
        ram = 12
        idlepc = 0x8018a560
        slot0 = NM-1E
    `3620`
        p_w_picpath = J:\c3620-i-mz.121-20.bin
        ram = 32
        idlepc = 0x60375d88         
        slot1 = NM-4T
                       
    `router R1`
        model = 3620
        f0/0 = PC1 E0/0
        s1/0 = R2 s1/0        
        s1/1 = R2 s1/1
    `router R2`
        model = 3620
        f0/0 = PC2 e0/0
    `router PC1`
        model = 2610      
    `router PC2`
        model = 2610
      
      

配置过程如下:


----PC1的配置-------
PC1(config)#no ip routing
PC1(config)#ip default-gateway 10.1.1.1
PC1(config)#interface e0/0
PC1(config-if)#ip address 10.1.1.100 255.255.255.0
PC1(config-if)#no shutdown
PC1(config-if)#end
PC1#
----PC2的配置-------
PC2#configure terminal
PC2(config)#no ip routing
PC2(config)#ip default-gateway 192.168.1.2
PC2(config)#interface e0/0
PC2(config-if)#ip address 192.168.1.100 255.255.255.0
PC2(config-if)#no shutdown
PC2(config-if)#end
----R1的配置-------
R1#configure terminal
R1(config)#interface f0/0
R1(config-if)#ip address 10.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#interface s1/0
R1(config-if)#ip address 12.12.12.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#interface s1/1
R1(config-if)#ip address 21.21.21.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#router eigrp 100
R1(config-router)#network 10.1.1.0   0.0.0.255
R1(config-router)#network 12.12.12.0 0.0.0.255
R1(config-router)#network 21.21.21.0 0.0.0.255
R1(config-router)#no auto-summary
R1(config-router)#end
R1#
----R2的配置-------
R2#configure terminal
R2(config)#interface s1/0
R2(config-if)#bandwidth 64
R2(config-if)#ip address 12.12.12.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#interface s1/1
R2(config-if)#bandwidth 128
R2(config-if)#ip address 21.21.21.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#interface f0/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)#router eigrp 100
R2(config-router)#network 192.168.1.0 0.0.0.255
R2(config-router)#network 12.12.12.0  0.0.0.255
R2(config-router)#network 21.21.21.0  0.0.0.255
R2(config-router)#!variance 2
R2(config-router)#no auto-summary
R2(config-router)#end
R2#

快捷配置方式,直接在SecurCRT标签中粘贴即可,SecurCRT的使用参考 http://www.netemu.cn/bbs/viewthread.php?tid=186
----PC1的配置-------
configure terminal
no ip routing
ip default-gateway 10.1.1.1
interface e0/0
ip address 10.1.1.100 255.255.255.0
no shutdown
end
----PC2的配置-------
configure terminal
no ip routing
ip default-gateway 192.168.1.2
interface e0/0
ip address 192.168.1.100 255.255.255.0
no shutdown
end
----R1的配置-------
configure terminal
interface f0/0
ip address 10.1.1.1 255.255.255.0
no shutdown
interface s1/0
ip address 12.12.12.1 255.255.255.0
no shutdown
interface s1/1
ip address 21.21.21.1 255.255.255.0
no shutdown
exit
router eigrp 100
network 10.1.1.0   0.0.0.255
network 12.12.12.0 0.0.0.255
network 21.21.21.0 0.0.0.255
no auto-summary
end

----R2的配置-------
configure terminal
interface s1/0
bandwidth 64
ip address 12.12.12.2 255.255.255.0
no shutdown
interface s1/1
bandwidth 128
ip address 21.21.21.2 255.255.255.0
no shutdown
interface f0/0
ip address 192.168.1.2 255.255.255.0
no shutdown
exit
router eigrp 100
network 192.168.1.0 0.0.0.255
network 12.12.12.0  0.0.0.255
network 21.21.21.0  0.0.0.255
no auto-summary
end

验证:
在没有修改variance的值之前,在R2上显示路由表
R2#show ip route         
Gateway of last resort is not set
     21.0.0.0/24 is subnetted, 1 subnets
C       21.21.21.0 is directly connected, Serial1/1
     10.0.0.0/24 is subnetted, 1 subnets
D       10.1.1.0 [90/20514560] via 21.21.21.1, 00:04:53, Serial1/1
     12.0.0.0/24 is subnetted, 1 subnets
C       12.12.12.0 is directly connected, Serial1/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
可以看到只有一条到达10.1.1.0 的路径。配置variance 2命令:
R2#configure terminal
R2(config)#router eigrp 100
R2(config-router)#variance 2
R2#end
R2#show ip route  
Gateway of last resort is not set
     21.0.0.0/24 is subnetted, 1 subnets
C       21.21.21.0 is directly connected, Serial1/1
     10.0.0.0/24 is subnetted, 1 subnets
D       10.1.1.0 [90/20514560] via 21.21.21.1, 00:00:52, Serial1/1
                 [90/40514560] via 12.12.12.1, 00:00:52, Serial1/0
     12.0.0.0/24 is subnetted, 1 subnets
C       12.12.12.0 is directly connected, Serial1/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
现在可以看到,到达10.1.1.0 有两条路径。
说明:variance 的值默认是1,代表等价链路的均衡负载,它的取值范围1~128,这个乘数代表了可以接受的不等价链路的度量值的倍数,在这个范围内的链路都将被接受,并且被加入到路由表中。
比如说有两条链路,一条度量值是20514560,另一条是40514560,如果没有设置过variance 的值,则会在路由表中出现度量值为20514560的路径,如果设置了variance 2,则两条路由都会出现在路由表中。

注意:如果还没有出现两条路径,请执行下面命令清除已经存在的路由表。
R2#clear ip route *
R2#show ip route