OSPF的应用之EIGRP[单区域与多区域]!(CISCO)

本文涉及的产品
云数据库 Redis 版,社区版 2GB
推荐场景:
搭建游戏排行榜
简介:

单区域:

1. 作业要求:

在ospf 中把eigrp学到的路由信息重分发过来,在eigrp中注入默认路由,实现能够有效的通信,让路由表少量化!

注入默认路由的三种方法

2. 拓扑图

image

 

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. 拓扑图

clip_image002

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



本文转自 gjp0731 51CTO博客,原文链接:http://blog.51cto.com/guojiping/950192

相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore     ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库 ECS 实例和一台目标数据库 RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
相关文章
|
7月前
|
网络架构
交换机与路由器技术-28-OSPF的NSSA区域
交换机与路由器技术-28-OSPF的NSSA区域
31 0
|
7月前
|
网络架构
交换机与路由器技术-25-OSPF多区域
交换机与路由器技术-25-OSPF多区域
25 0
|
7月前
|
网络架构
交换机与路由器技术-26-OSPF末梢区域
交换机与路由器技术-26-OSPF末梢区域
21 0
|
7月前
|
网络架构
交换机与路由器技术-24-OSPF单区域配置
交换机与路由器技术-24-OSPF单区域配置
43 0
|
网络协议 网络架构
OSPF路由协议——OSPF多区域原理和配置
六 OSPF的三种通信量 1.域内通信量 (lntra-Area Traffic) 单个区域内的路由器之间交换数据包构成的通信量 2.域间通信量 (Inter-Area Traffic) 不同区域的路由器之间交换数据包构成的通信量 3.外部通信量 (External Traffic) OSPF域内的路由器与OSPF区域外或另一个自治系统内 的路由器之间交换机数据包构成的通信量
379 0
OSPF路由协议——OSPF多区域原理和配置
|
网络协议 网络架构
|
网络协议 网络架构