怎么配置多区域OSPF协议

怎么配置多区域OSPF协议

OSPF也是一种路由协议,相比如动态路由和静态路由,OSPF路由协议有着减少路由表的功能和减少SPF的计算频率,同时也可以用区域的概念来管理路由表和减少一些路由表的不利影响。下面就来讲讲怎么配置多区域OSPF协议。

找出四台2811类的路由器,并将它们按照一定的顺序排开来,并将配置线连接起来,如下图所示:

配置路由器r1和r2,配置命令如下:

r1#conf t

Enter configuration commands, one per line. End with CNTL/Z.

r1(config)#router ospf 1

r1(config-router)#router-id 1.1.1.1

r1(config-router)#network 1.1.1.0 255.255.255.0 area 1

r1(config-router)#network 192.168.12.0 255.255.255.0 area 1

r2#conf t

Enter configuration commands, one per line. End with CNTL/Z.

r2(config-router)#router ospf 1

r2(config-router)#router-id 2.2.2.2

r2(config-router)#network 192.168.12.0 255.255.255.0 area 1

r2(config-router)#network 192.168.23.0 255.255.255.0 area 0

r2(config-router)#network 2.2.2.0 255.255.255.0 area 0

结果如下图所示:

配置路由器r3和r4,配置命令如下图所示:

r3>enable

r3#conf t

Enter configuration commands, one per line. End with CNTL/Z.

r3(config-router)#router ospf 1

r3(config-router)#router-id 3.3.3.3

r3(config-router)#network 192.168.23.0 255.255.255.0 area 0

r3(config-router)#network 192.168.34.0 255.255.255.0 area 0

r3(config-router)#network 3.3.3.0 255.255.255.0 area 0

r4#conf t

r4(config-router)#router ospf 1

r4(config-router)#router-id 4.4.4.4

r4(config-router)#network 192.168.34.0 0.0.0.255 area 2

r4(config-router)#redistribute connected subnets

结果如下图所示:

实验调试,用“show iP route”命令测试,如下图所示:

用“show ip ospf database”命令查看路由器r1和r2的配置信息,如下图所示: