2、区别外部汇总的路由。
3、掌握OSPF 的外部汇总路由类型及计算方法。
配置好基本信息,测通继续。
在R3(ASBR:自治系统边界路由器)上的配置:
R3(config)#router ospf 1
R3(config-router)#network 192.168.1.4 0.0.0.3 a 0
R3(config-router)#exit
R3(config)#router rip
R3(config-router)#network 172.16.0.0
R3(config-router)#exit
各设备路由表:
R1#show ip route
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 2 subnets
C 10.1.2.0 is directly connected, Loopback1
C 10.1.1.0 is directly connected, Loopback0
192.168.1.0/30 is subnetted, 2 subnets
C 192.168.1.0 is directly connected, Serial0/0
O IA 192.168.1.4 [110/128] via 192.168.1.2, 00:06:34, Serial0/0
R2#show ip route
Gateway of last resort is not set
10.0.0.0/32 is subnetted, 2 subnets
O 10.1.2.1 [110/65] via 192.168.1.1, 00:06:40, Serial0/0
O 10.1.1.1 [110/65] via 192.168.1.1, 00:06:40, Serial0/0
192.168.1.0/30 is subnetted, 2 subnets
C 192.168.1.0 is directly connected, Serial0/0
C 192.168.1.4 is directly connected, Serial0/1
R3#show ip route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.1.0 is directly connected, Serial0/1
R 172.16.2.0 [120/1] via 172.16.1.2, 00:00:22, Serial0/1
R 172.16.3.0 [120/1] via 172.16.1.2, 00:00:22, Serial0/1
10.0.0.0/32 is subnetted, 2 subnets
O IA 10.1.2.1 [110/129] via 192.168.1.5, 00:03:33, Serial0/0
O IA 10.1.1.1 [110/129] via 192.168.1.5, 00:03:33, Serial0/0
192.168.1.0/30 is subnetted, 2 subnets
O IA 192.168.1.0 [110/128] via 192.168.1.5, 00:03:33, Serial0/0
C 192.168.1.4 is directly connected, Serial0/0
R4#show ip route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.1.0 is directly connected, Serial0/0
C 172.16.2.0 is directly connected, Loopback0
C 172.16.3.0 is directly connected, Loopback1
R4只有直连路由,R1和R2没有RIP区域的路由,所以它们不能测通RIP区的地址:
R1#ping 192.168.1.6
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.6, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/40/60 ms
R1#ping 172.16.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
在R3 上配置重分发:
R3(config)#router ospf 1
R3(config-router)#redistribute rip metric 200 subnets
R3(config-router)#exit
R3(config)#router rip
R3(config-router)#redistribute ospf 1 metric 10
R3(config-router)#exit
查看R1 / R4路由器路由表并使用ping 命令确认路由:
R1#show ip route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 3 subnets
O E2 172.16.1.0 [110/200] via 192.168.1.2, 00:01:46, Serial0/0
O E2 172.16.2.0 [110/200] via 192.168.1.2, 00:01:46, Serial0/0
O E2 172.16.3.0 [110/200] via 192.168.1.2, 00:01:46, Serial0/0
10.0.0.0/24 is subnetted, 2 subnets
C 10.1.2.0 is directly connected, Loopback1
C 10.1.1.0 is directly connected, Loopback0
192.168.1.0/30 is subnetted, 2 subnets
C 192.168.1.0 is directly connected, Serial0/0
O IA 192.168.1.4 [110/128] via 192.168.1.2, 01:39:03, Serial0/0
R1#ping 172.16.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/63/96 ms
R4#show ip route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.1.0 is directly connected, Serial0/0
C 172.16.2.0 is directly connected, Loopback0
C 172.16.3.0 is directly connected, Loopback1
R 10.0.0.0/8 [120/10] via 172.16.1.1, 00:00:06, Serial0/0
R 192.168.1.0/24 [120/10] via 172.16.1.1, 00:00:06, Serial0/0
现在学习到的外网路由已经是E2的类型。此时显示的cost 值为200(配置的时候手动指定200),其中没有包含了到达R3 的cost。
如果学到的外网路由是E1类型,则会加上到达R3的cost:200+128=328
查看R1 路由器的链路状态数据库:
在R1中显示外网路由为3条,为了减少路由条目,可在R3上汇总外部路由:
R3(config)#router ospf 1
R3(config-router)#summary-address 172.16.0.0 255.255.0.0
R3(config-router)#exit
再查看R1的路由表:
R1# show ip route
Gateway of last resort is not set
O E2 172.16.0.0/16 [110/200] via 192.168.1.2, 00:00:21, Serial0/0
10.0.0.0/24 is subnetted, 2 subnets
C 10.1.2.0 is directly connected, Loopback1
C 10.1.1.0 is directly connected, Loopback0
192.168.1.0/30 is subnetted, 2 subnets
C 192.168.1.0 is directly connected, Serial0/0
O IA 192.168.1.4 [110/128] via 192.168.1.2, 01:53:10, Serial0/0
确认汇总成功。