【技术分享】配置OSPF多区域
发布作者:微思网络 发布时间:2022-06-13 浏览量:0次
掌握多区域的 OSPF 配置方法。 区别不同域的路由。 掌握 OSPF 的路由汇总配置。 掌握 OSPF的基本配置命令
在R1,R2,R3上配置动态路由协议OSPF,使得拓扑中所有网络可以互相通信,要求每个路由器配置一个loopback 0接口地址作为router-id,其中R1为1.1.1.1, R2为2.2.2.2, R3为3.3.3.3 ,子网掩码为255.255.255.255 使用OSPF常用验证命令,查看OSPF的邻居表、路由表,并测试子网之间的连通性 配置R1 配置R2 配置R3 使用OSPF常用验证命令,查看OSPF的邻居表、路由表,并测试子网之间的连通性 显示运行ospf的接口serial 0/1/0, 所在的区域为0,,进程号为1 , router-id为1.1.1.1,接口cost值为64创建R1的loopback 0接口及配置IP地址
R1(config)#interface loopback 0
R1(config-if)#ip address 1.1.1.1 255.255.255.255
启用OSPF,进程号为1
R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 1.1.1.1 0.0.0.0 area 0
R1(config-router)#network 11.1.1.1 0.0.0.0 area 0
R1(config-router)#network 12.1.1.1 0.0.0.0 area 0
R1(config-router)#network 13.1.1.1 0.0.0.0 area 0创建R2的loopback 0接口及配置IP地址
R2(config)#interface loopback 0
R2(config-if)#ip address 2.2.2.2 255.255.255.255
启用OSPF,进程号为2
R2(config)#router ospf 2
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 2.2.2.2 0.0.0.0 area 0
R2(config-router)#network 12.1.1.2 0.0.0.0 area 0
R2(config-router)#network 192.168.1.254 0.0.0.0 area 0
R2(config-router)#network 23.1.1.2 0.0.0.0 area 1创建R3的loopback 0接口及配置IP地址
R3(config)#interface loopback 0
R3(config-if)#ip address 3.3.3.3 255.255.255.255
启用OSPF,进程号为3
R3(config)#router ospf 3
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 3.3.3.3 0.0.0.0 area 0
R3(config-router)#network 13.1.1.3 0.0.0.0 area 0
R3(config-router)#network 23.1.1.3 0.0.0.0 area 1
R3(config-router)#network 172.16.1.254 0.0.0.0 area 0
在R1上查看邻居表R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
3.3.3.3 0 FULL/ - 00:00:32 13.1.1.3 Serial0/1/1
2.2.2.2 0 FULL/ - 00:00:38 12.1.1.2 Serial0/1/0
R1的两个邻居R2:2.2.2.2 , R3:3.3.3.3
在R1上查看路由表R1#show ip route ospf
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 12.1.1.2, 00:30:10, Serial0/1/0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/65] via 13.1.1.3, 00:30:10, Serial0/1/1
23.0.0.0/24 is subnetted, 1 subnets
O IA 23.1.1.0 [110/128] via 13.1.1.3, 00:30:10, Serial0/1/1
[110/128] via 12.1.1.2, 00:30:10, Serial0/1/0
172.16.0.0/24 is subnetted, 1 subnets
O 172.16.1.0 [110/65] via 13.1.1.3, 00:30:10, Serial0/1/1
O 192.168.1.0/24 [110/65] via 12.1.1.2, 00:30:10, Serial0/1/0
在R1上查看运行OSPF的接口serial 0/0R1#show ip ospf interface serial 0/1/0
Serial0/1/0 is up, line protocol is up
Internet Address 12.1.1.1/24, Area 0
Process ID 1, Router ID 1.1.1.1, Network Type POINT_TO_POINT, Cost: 64
.........(略)........
查看路由器当前运行的路由协议R1#show ip protocols
Routing Protocol is "ospf 1"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 13.1.1.1
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
1.1.1.1 0.0.0.0 area 0
11.1.1.1 0.0.0.0 area 0
12.1.1.1 0.0.0.0 area 0
13.1.1.1 0.0.0.0 area 0
Routing Information Sources:
Gateway Distance Last Update
3.3.3.3 110 00:01:58
2.2.2.2 110 00:01:58
1.1.1.1 110 00:01:58
Distance: (default is 110)
在R2上查看邻居表R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
3.3.3.3 1 FULL/ - 00:00:32 23.1.1.3 Serial0/1
1.1.1.1 1 FULL/ - 00:00:34 12.1.1.1 Serial0/0
在R2上查看路由表R2#show ip route ospf
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/65] via 12.1.1.1, 00:33:22, Serial0/0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/129] via 12.1.1.1, 00:33:22, Serial0/0
172.16.0.0/24 is subnetted, 1 subnets
O 172.16.1.0 [110/129] via 12.1.1.1, 00:33:22, Serial0/0
11.0.0.0/24 is subnetted, 1 subnets
O 11.1.1.0 [110/65] via 12.1.1.1, 00:33:22, Serial0/0
13.0.0.0/24 is subnetted, 1 subnets
O 13.1.1.0 [110/128] via 12.1.1.1, 00:33:22, Serial0/0
在R3上查看邻居表R3#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/ - 00:00:37 23.1.1.2 Serial0/1
1.1.1.1 1 FULL/ - 00:00:34 13.1.1.1 Serial0/0
在R3上查看路由表R3#show ip route ospf
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/65] via 13.1.1.1, 00:35:43, Serial0/0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/129] via 13.1.1.1, 00:35:43, Serial0/0
11.0.0.0/24 is subnetted, 1 subnets
O 11.1.1.0 [110/65] via 13.1.1.1, 00:35:43, Serial0/0
12.0.0.0/24 is subnetted, 1 subnets
O 12.1.1.0 [110/128] via 13.1.1.1, 00:35:43, Serial0/0
O 192.168.1.0/24 [110/129] via 13.1.1.1, 00:35:43, Serial0/0
使用Ping测试网络间连通性:
测试网络11.1.1.0/24到192.168.1.0/24的连通性
测试网络11.1.1.0/24到172.16.1.0/24的连通性
测试网络192.168.1.0/24到172.16.1.0/24的连通性