先为路由器R1、R2、R3、R4配置好接口地址
R1>en
R1#conf t
R1(config)#int fa0/1
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int fa0/0
R1(config-if)#ip add 192.168.2.1 255.255.255.0
R1(config-if)#no shut
R2>en
R2#conf t
R2(config)#int fa0/1
R2(config-if)#ip add 192.168.2.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int fa0/0
R2(config-if)#ip add 192.168.3.1 255.255.255.0
R2(config-if)#no shut
R3>en
R3#conf t
R3(config)#int fa0/1
R3(config-if)#ip add 192.168.3.2 255.255.255.0
R3(config-if)#no shut
R3(config-if)#int fa0/0
R3(config-if)#ip add 192.168.4.1 255.255.255.0
R3(config-if)#no shut
R4>en
R4#conf t
R4(config)#int fa0/0
R4(config-if)#ip add 192.168.4.2 255.255.255.0
R4(config-if)#no shut
R4(config-if)#int fa0/1
R4(config-if)#ip add 192.168.5.1 255.255.255.0
R4(config-if)#no shut
R4(config-if)#ex
配置区域:R1与R2同在area 1区域、R3在area 2区域、R3路由的Fa0/0和R4路由在RIP区域内。
注释:net 49.0001.0000.0000.0001.00中的49表示国家,0001表示地区,0000.0000.0001表示地区内的某一个,因为NSEL对路由器永远设零所以这里是00。
R1(config)#router isis
R1(config-router)#net 49.0001.0000.0000.0001.00
R1(config-router)#is-type level-1//封装类型
R1(config-if-range)#ex
R1(config)#int range fa0/0 -1//作用端口上
R1(config-if-range)#ip router isis
R2(config)#router isis
R2(config-router)#net 49.0001.0000.0000.0002.00
R2(config-router)#is-type level-1-2
R2(config-router)#ex
R2(config)#int range fa0/0 -1
R2(config-if-range)#ip router isis
R3(config)#router isis
R3(config-router)#net 49.0002.0000.0000.0001.00
R3(config-router)#is-type level-2
R3(config-router)#ex
R3(config)#int fa0/1
R3(config-if)#ip router isis
R3(config-if)#ex
R3(config)#router rip
R3(config-router)#net 192.168.4.0//宣告网段
R3(config-router)#version 2//版本号
R3(config-router)#no auto-summary//关闭路由汇总功能
R4(config)#router rip
R4(config-router)#net 192.168.4.0
R4(config-router)#net 192.168.5.0
R4(config-router)#version 2
R4(config-router)#no auto-summary
上面配置完成后证明你已经完成了一半了但是,还有一个关键的一步没有做,也是这个实验的重点路由重分发,下面先查看一下路由表,并且对比一下路由重分发前后的对比。
R1(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 192.168.2.2 to network 0.0.0.0
C 192.168.1.0/24 is directly connected, FastEthernet0/1
C 192.168.2.0/24 is directly connected, FastEthernet0/0
i L1 192.168.3.0/24 [115/20] via 192.168.2.2, FastEthernet0/0
i*L1 0.0.0.0/0 [115/10] via 192.168.2.2, FastEthernet0/0
R2(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
i L1 192.168.1.0/24 [115/20] via 192.168.2.1, FastEthernet0/1
C 192.168.2.0/24 is directly connected, FastEthernet0/1
C 192.168.3.0/24 is directly connected, FastEthernet0/0
从R1、R2的路由表上就可以看出来并没有RIP区域的网段信息。而R3上的路由表信息确有1段和2段的信息,这是为什么呢?因为R3路由器上有area 2和RIP两个区域。在area 2区域中就会学习到area 1区域内的信息,而RIP有属于自己区域的信息,合起来就是一张信息完整的路由表。但是这并不能说明它们之间就是互通的,这就好比住在同一个屋檐下的两个房间,虽然都知道有对方存在但却并不互相认识知道对方叫什么一样。这也是为什么R3路由会有一张较完整的路由表的原因。但是还要做一个路由重分发让它们互相认识,才能有交流(流量通过)。
R3(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.4.0/24 is directly connected, FastEthernet0/0
R 192.168.5.0/24 [120/1] via 192.168.4.2, 00:00:06, FastEthernet0/0
i L2 192.168.1.0/24 [115/30] via 192.168.3.1, FastEthernet0/1
i L2 192.168.2.0/24 [115/20] via 192.168.3.1, FastEthernet0/1
C 192.168.3.0/24 is directly connected, FastEthernet0/1
R4(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.4.0/24 is directly connected, FastEthernet0/0
C 192.168.5.0/24 is directly connected, FastEthernet0/1
下面是路由重分发命令的详细配置过程。然后在通过show ip route 命令查看路由表信息
注释:redistribute rip重分发为RIP协议,metric 10 设置度量值为10,metric-type设置度量值类型,redistribute connection重分发直连网段(目的让R4路由器学习到)
R3(config)#router isis
R3(config-router)#redistribute rip metric 10 metric-type external
R3(config-router)#ex
R3(config)#router rip
R3(config-router)#redistribute isis level-1-2 metric 5
R3(config-router)#redistribute connected
R2(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
i L2 192.168.4.0/24 [115/84] via 192.168.3.2, FastEthernet0/0
i L2 192.168.5.0/24 [115/84] via 192.168.3.2, FastEthernet0/0(通过这两条可以看出R2已经学习到了RIP区域的信息条目)
i L1 192.168.1.0/24 [115/20] via 192.168.2.1, FastEthernet0/1
C 192.168.2.0/24 is directly connected, FastEthernet0/1
C 192.168.3.0/24 is directly connected, FastEthernet0/0
R3(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.4.0/24 is directly connected, FastEthernet0/0
R 192.168.5.0/24 [120/1] via 192.168.4.2, 00:00:10, FastEthernet0/0
i L2 192.168.1.0/24 [115/30] via 192.168.3.1, FastEthernet0/1
i L2 192.168.2.0/24 [115/20] via 192.168.3.1, FastEthernet0/1
C 192.168.3.0/24 is directly connected, FastEthernet0/1
R4(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.4.0/24 is directly connected, FastEthernet0/0
C 192.168.5.0/24 is directly connected, FastEthernet0/1
R 192.168.1.0/24 [120/5] via 192.168.4.1, 00:00:00, FastEthernet0/0
R 192.168.2.0/24 [120/5] via 192.168.4.1, 00:00:00, FastEthernet0/0
R 192.168.3.0/24 [120/1] via 192.168.4.1, 00:00:00, FastEthernet0/0
最后为vpcs配置地址并测试网络有没有互通。