单区域:
1. 作业要求:
在ospf 中把eigrp学到的路由信息重分发过来,在eigrp中注入默认路由,实现能够有效的通信,让路由表少量化!
注入默认路由的三种方法
2. 拓扑图
1. 设备配置如下:
R1(config)#int s1/0
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int s1/1
R1(config-if)#ip add 192.168.3.1 255.255.255.0
R1(config-if)#no shut
R1(config)#line cons 0
R1(config-line)#logging Synchronous
R1(config-line)#exec-timeout 0 0
R1(config)#router ospf 223
R1(config-router)#network 192.168.3.0 0.0.0.255 area 0
R1(config)#router eigrp 223
R1(config-router)#network 192.168.1.0
R2(config)#int s1/0
R2(config-if)#ip add 192.168.1.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int s1/2
R2(config-if)#ip add 192.168.2.1 255.255.255.0
R2(config-if)#no shut
R2(config)#int lo 1
R2(config-if)#ip add 192.168.5.1 255.255.255.0
R2(config-if)#no shut
R2(config)#router eigrp 223
R2(config-router)#network 192.168.1.0
R2(config-router)#network 192.168.2.0
R2(config-router)#network 192.168.5.0
R3(config)#int s 1/2
R3(config-if)#ip add 192.168.2.2 255.255.255.0
R3(config-if)#no shut
R3(config)#int lo 1
R3(config-if)#ip add 192.168.6.1 255.255.255.0
R3(config)#router eigrp 223
R3(config-router)#network 192.168.2.0
R3(config-router)#network 192.168.6.0
在R3上查看路由表如下:
D 192.168.5.0/24 [90/2297856] via 192.168.2.1, 00:22:57, Serial1/2
C 192.168.6.0/24 is directly connected, Loopback1
D 192.168.1.0/24 [90/2681856] via 192.168.2.1, 00:31:30, Serial1/2
C 192.168.2.0/24 is directly connected, Serial1/2
R3#
R4(config)#int s1/1
R4(config-if)#ip add 192.168.3.2 255.255.255.0
R4(config-if)#no shut
R4(config-if)#int s1/3
R4(config-if)#ip add 192.168.4.1 255.255.255.0
R4(config-if)#no shut
R4(config-if)#int lo1
R4(config-if)#ip add 192.168.7.1 255.255.255.0
R4(config-if)#exit
R4(config)#router ospf 223
R4(config-router)#network 192.168.3.0 0.0.0.255 area 0
R4(config-router)#network 192.168.4.0 0.0.0.255 area 0
R4(config-router)#network 192.168.7.0 0.0.0.255 area 0
R5(config)#int s1/3
R5(config-if)#ip add 192.168.4.2 255.255.255.0
R5(config-if)#no shut
R5(config-if)#int lo 1
R5(config-if)#ip add 192.168.8.1 255.255.255.0
R5(config-if)#no shut
R5(config-if)#router ospf 223
R5(config-router)#network 192.168.4.0 0.0.0.255 area 0
R5(config-router)#network 192.168.8.0 0.0.0.255 area 0
查看R5路由器的路由表:
C 192.168.8.0/24 is directly connected, Loopback1
C 192.168.4.0/24 is directly connected, Serial1/3
192.168.7.0/32 is subnetted, 1 subnets
O 192.168.7.1 [110/65] via 192.168.4.1, 00:01:33, Serial1/3
O 192.168.3.0/24 [110/128] via 192.168.4.1, 00:01:33, Serial1/3
R5#
4.测试
查看R1路由器的路由表(路由重分发前)
(由于R1是边界路由器,不但在运行EIGRP协议中,还在OSPF 中,所以路由表比较全)
192.168.8.0/32 is subnetted, 1 subnets
O 192.168.8.1 [110/129] via 192.168.3.2, 00:05:47, Serial1/1
O 192.168.4.0/24 [110/128] via 192.168.3.2, 00:05:47, Serial1/1
D 192.168.5.0/24 [90/2297856] via 192.168.1.2, 00:22:19, Serial1/0
D 192.168.6.0/24 [90/2809856] via 192.168.1.2, 00:30:21, Serial1/0
192.168.7.0/32 is subnetted, 1 subnets
O 192.168.7.1 [110/65] via 192.168.3.2, 00:05:47, Serial1/1
C 192.168.1.0/24 is directly connected, Serial1/0
D 192.168.2.0/24 [90/2681856] via 192.168.1.2, 00:35:05, Serial1/0
C 192.168.3.0/24 is directly connected, Serial1/1
R1#
R1(config)#router ospf 223
R1(config-router)#redistribute eigrp 223 metric 200 //重分发eigrp
% Only classful networks will be redistributed
R5上查看路由表:
C 192.168.8.0/24 is directly connected, Loopback1
C 192.168.4.0/24 is directly connected, Serial1/3
O E2 192.168.5.0/24 [110/200] via 192.168.4.1, 00:02:23, Serial1/3
O E2 192.168.6.0/24 [110/200] via 192.168.4.1, 00:02:23, Serial1/3
192.168.7.0/32 is subnetted, 1 subnets
O 192.168.7.1 [110/65] via 192.168.4.1, 00:02:23, Serial1/3
O E2 192.168.1.0/24 [110/200] via 192.168.4.1, 00:02:23, Serial1/3
O E2 192.168.2.0/24 [110/200] via 192.168.4.1, 00:02:23, Serial1/3
O 192.168.3.0/24 [110/128] via 192.168.4.1, 00:02:24, Serial1/3
R5#
在EIGRP 中注入默认路由的3种方法:
第一种:
R1(config)#ip route 0.0.0.0 0.0.0.0 s1/1
R1(config)#router eigrp 223
R1(config-router)#network 0.0.0.0
R1 的路由表:
192.168.8.0/32 is subnetted, 1 subnets
O 192.168.8.1 [110/129] via 192.168.3.2, 00:06:41, Serial1/1
O 192.168.4.0/24 [110/128] via 192.168.3.2, 00:06:41, Serial1/1
D 192.168.5.0/24 [90/2297856] via 192.168.1.2, 00:35:10, Serial1/0
D 192.168.6.0/24 [90/2809856] via 192.168.1.2, 00:43:11, Serial1/0
192.168.7.0/32 is subnetted, 1 subnets
O 192.168.7.1 [110/65] via 192.168.3.2, 00:06:41, Serial1/1
C 192.168.1.0/24 is directly connected, Serial1/0
D 192.168.2.0/24 [90/2681856] via 192.168.1.2, 00:47:56, Serial1/0
C 192.168.3.0/24 is directly connected, Serial1/1
S* 0.0.0.0/0 is directly connected, Serial1/1
R1#
R3 的路由表:
D 192.168.5.0/24 [90/2297856] via 192.168.2.1, 00:37:04, Serial1/2
C 192.168.6.0/24 is directly connected, Loopback1
D 192.168.1.0/24 [90/2681856] via 192.168.2.1, 00:45:37, Serial1/2
C 192.168.2.0/24 is directly connected, Serial1/2
D 192.168.3.0/24 [90/3193856] via 192.168.2.1, 00:03:12, Serial1/2
D* 0.0.0.0/0 [90/3193856] via 192.168.2.1, 00:03:12, Serial1/2
R3#
第二种:
R1(config)#ip route 0.0.0.0 0.0.0.0 s1/1
R1(config)#router eigrp 223
R1(config-router)#redistribute static
在R3上查看路由表:
D 192.168.5.0/24 [90/2297856] via 192.168.2.1, 01:00:35, Serial1/2
C 192.168.6.0/24 is directly connected, Loopback1
D 192.168.1.0/24 [90/2681856] via 192.168.2.1, 01:09:09, Serial1/2
C 192.168.2.0/24 is directly connected, Serial1/2
D*EX 0.0.0.0/0 [170/3193856] via 192.168.2.1, 00:03:32, Serial1/2
R3#
第三种:
R1(config)#ip default-network 192.168.3.0
R1(config)#ip route 192.168.3.0 255.255.255.0 null0
R1(config)#router eigrp 223
R1(config-router)#network 192.168.3.0
R2的路由表如下:
C 192.168.5.0/24 is directly connected, Loopback1
D 192.168.6.0/24 [90/2297856] via 192.168.2.2, 01:17:34, Serial1/2
C 192.168.1.0/24 is directly connected, Serial1/0
C 192.168.2.0/24 is directly connected, Serial1/2
D* 192.168.3.0/24 [90/2681856] via 192.168.1.1, 00:00:09, Serial1/0
R2#
R3#ping 192.168.8.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.8.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 56/84/120 ms
R3#ping 192.168.4.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.4.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 64/80/124 ms
R3#
R1(config)#ip default-network 0.0.0.0
R1(config)#ip route 0.0.0.0 0.0.0.0 null0
R1(config)#router eigrp 223
R1(config-router)#network 0.0.0.0
C 192.168.5.0/24 is directly connected, Loopback1
D 192.168.6.0/24 [90/2297856] via 192.168.2.2, 00:11:52, Serial1/2
C 192.168.1.0/24 is directly connected, Serial1/0
C 192.168.2.0/24 is directly connected, Serial1/2
D 192.168.3.0/24 [90/2681856] via 192.168.1.1, 00:03:14, Serial1/0
D* 0.0.0.0/0 [90/2681856] via 192.168.1.1, 00:00:11, Serial1/0
R2#
R1(config)#router eigrp 223
R1(config-router)#redistribute ospf 223 metric 1000 100 255 10 1500
192.168.8.0/32 is subnetted, 1 subnets
D EX 192.168.8.1 [170/3609600] via 192.168.2.1, 00:00:27, Serial1/2
D EX 192.168.4.0/24 [170/3609600] via 192.168.2.1, 00:00:27, Serial1/2
D 192.168.5.0/24 [90/2297856] via 192.168.2.1, 00:17:24, Serial1/2
C 192.168.6.0/24 is directly connected, Loopback1
192.168.7.0/32 is subnetted, 1 subnets
D EX 192.168.7.1 [170/3609600] via 192.168.2.1, 00:00:27, Serial1/2
D 192.168.1.0/24 [90/2681856] via 192.168.2.1, 00:17:24, Serial1/2
C 192.168.2.0/24 is directly connected, Serial1/2
D 192.168.3.0/24 [90/3193856] via 192.168.2.1, 00:10:11, Serial1/2
多区域:
1. 作业要求:
<1 eigrp 协议的掌握
<2 在ASBR上进行路由重分发
n 在eigrp中把ospf学到的路由信息以明析路由的方式发送过来.
n 在ospf 中注入默认路由(为了学习,才这样做, 现实中一般不这样使用)
2. 拓扑图
3. 设备介绍:路由器:cisco 3620
4. 设备配置命令:
R1(config)#int lo 1
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int s1/0
R1(config-if)#ip add 192.168.2.1 255.255.255.0
R1(config-if)#no shut
R1(config)#router ospf 223
R1(config-router)#network 192.168.1.0 0.0.0.255 area 1
R1(config-router)#network 192.168.2.0 0.0.0.255 area 1
R2(config)#int s1/0
R2(config-if)#ip add 192.168.2.2 255.255.255.0
R2(config-if)#no shut
R2(config)#int s1/1
R2(config-if)#ip add 192.168.3.1 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int s1/2
R2(config-if)#ip add 192.168.7.1 255.255.255.0
R2(config-if)#no shut
R2(config)#router ospf 223
R2(config-router)#network 192.168.2.0 0.0.0.255 area 1
R2(config-router)#network 192.168.3.0 0.0.0.255 area 0
R2(config)#router eigrp 223
R2(config-router)#network 192.168.7.0
R3(config)#int s1/1
R3(config-if)#ip add 192.168.3.2 255.255.255.0
R3(config-if)#no shut
R3(config-if)#int s1/2
R3(config-if)#ip add 192.168.4.1 255.255.255.0
R3(config-if)#no shut
R3(config)#router ospf 223
R3(config-router)#network 192.168.3.0 0.0.0.255 area 0
R3(config-router)#network 192.168.4.0 0.0.0.255 area 0
R4(config)#int s1/2
R4(config-if)#ip add 192.168.4.2 255.255.255.0
R4(config-if)#no shut
R4(config-if)#int s1/3
R4(config-if)#ip add 192.168.5.1 255.255.255.0
R4(config-if)#no shut
R4(config)#router ospf 223
R4(config-router)#network 192.168.4.0 0.0.0.255 area 0
R4(config-router)#network 192.168.5.0 0.0.0.255 area 2
R5(config)#int s1/3
R5(config-if)#ip add 192.168.5.2 255.255.255.0
R5(config-if)#no shut
R5(config-if)#int lo1
R5(config-if)#ip add 192.168.6.1 255.255.255.0
R5(config-if)#no shut
R5(config)#router ospf 223
R5(config-router)#network 192.168.5.0 0.0.0.255 area 2
R5(config-router)#network 192.168.6.0 0.0.0.255 area 2
R6(config)#int s1/2
R6(config-if)#ip add 192.168.7.2 255.255.255.0
R6(config-if)#no shut
R6(config-if)#int s1/3
R6(config-if)#ip add 192.168.8.1 255.255.255.0
R6(config-if)#no shut
R6(config-if)#router eigrp 223
R6(config-router)#network 192.168.7.0
R6(config-router)#network 192.168.8.0
R7(config)#int s 1/3
R7(config-if)#ip add 192.168.8.2 255.255.255.0
R7(config-if)#no shut
R7(config-if)#int lo1
R7(config-if)#ip add 192.168.9.1 255.255.255.0
R7(config)#router eigrp 223
R7(config-router)#network 192.168.8.0
R7(config-router)#network 192.168.9.0
R4的路由表:
C 192.168.4.0/24 is directly connected, Serial1/2
C 192.168.5.0/24 is directly connected, Serial1/3
192.168.6.0/32 is subnetted, 1 subnets
O 192.168.6.1 [110/65] via 192.168.5.2, 00:10:25, Serial1/3
192.168.1.0/32 is subnetted, 1 subnets
O IA 192.168.1.1 [110/193] via 192.168.4.1, 00:10:25, Serial1/2
O IA 192.168.2.0/24 [110/192] via 192.168.4.1, 00:10:25, Serial1/2
O 192.168.3.0/24 [110/128] via 192.168.4.1, 00:12:30, Serial1/2
R4#
C 192.168.8.0/24 is directly connected, Serial1/3
C 192.168.9.0/24 is directly connected, Loopback1
D 192.168.7.0/24 [90/2681856] via 192.168.8.1, 00:04:43, Serial1/3
R7#
D 192.168.8.0/24 [90/2681856] via 192.168.7.2, 00:00:24, Serial1/2
D 192.168.9.0/24 [90/2809856] via 192.168.7.2, 00:00:24, Serial1/2
O 192.168.4.0/24 [110/128] via 192.168.3.2, 00:30:14, Serial1/1
O IA 192.168.5.0/24 [110/192] via 192.168.3.2, 00:30:10, Serial1/1
192.168.6.0/32 is subnetted, 1 subnets
O IA 192.168.6.1 [110/193] via 192.168.3.2, 00:28:05, Serial1/1
C 192.168.7.0/24 is directly connected, Serial1/2
192.168.1.0/32 is subnetted, 1 subnets
O 192.168.1.1 [110/65] via 192.168.2.1, 05:35:43, Serial1/0
C 192.168.2.0/24 is directly connected, Serial1/0
C 192.168.3.0/24 is directly connected, Serial1/1
R2#
5. 路由重分发
ASBR 上进行路由重分发:
R2(config)#router eigrp 223
R2(config-router)#redistribute ospf 223 metric 1000 100 255 1 1500
C 192.168.8.0/24 is directly connected, Serial1/3
C 192.168.9.0/24 is directly connected, Loopback1
D EX 192.168.4.0/24 [170/3609600] via 192.168.8.1, 00:06:27, Serial1/3
D EX 192.168.5.0/24 [170/3609600] via 192.168.8.1, 00:06:27, Serial1/3
192.168.6.0/32 is subnetted, 1 subnets
D EX 192.168.6.1 [170/3609600] via 192.168.8.1, 00:06:27, Serial1/3
D 192.168.7.0/24 [90/2681856] via 192.168.8.1, 00:11:07, Serial1/3
192.168.1.0/32 is subnetted, 1 subnets
D EX 192.168.1.1 [170/3609600] via 192.168.8.1, 00:06:28, Serial1/3
D EX 192.168.2.0/24 [170/3609600] via 192.168.8.1, 00:06:28, Serial1/3
D EX 192.168.3.0/24 [170/3609600] via 192.168.8.1, 00:06:28, Serial1/3
R7#
R2(config)#router ospf 223
R2(config-router)#default-information originate metric 200 always
O IA 192.168.4.0/24 [110/128] via 192.168.5.1, 00:43:46, Serial1/3
C 192.168.5.0/24 is directly connected, Serial1/3
C 192.168.6.0/24 is directly connected, Loopback1
192.168.1.0/32 is subnetted, 1 subnets
O IA 192.168.1.1 [110/257] via 192.168.5.1, 00:43:46, Serial1/3
O IA 192.168.2.0/24 [110/256] via 192.168.5.1, 00:43:46, Serial1/3
O IA 192.168.3.0/24 [110/192] via 192.168.5.1, 00:43:46, Serial1/3
O*E2 0.0.0.0/0 [110/200] via 192.168.5.1, 00:00:04, Serial1/3
R5#
6. 测试:
R5#ping 192.168.9.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.9.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 80/163/324 ms
R7#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/77/160 ms