|
Fastethernet0/0 |
Fastethernet1/0 |
R1 |
192.168.12.1/24 |
N/A |
R2 |
192.168.12.2/24 |
192.168.23.2/24 |
R3 |
192.168.23.3/24 |
192.168.34.3/24 |
R4 |
192.168.34.4/24 |
N/A |
l 现有四台路由器运行OSPF协议,进程为1。设R1与R2为区域1,R2与R3为区域0,R3与R4区域为2.
l 四台设备各配一个环回地址且分别都手动指定Router-id,分别为1.1.1.1、2.2.2.2、3.3.3.3、4.4.4.4。
l 实现R1与R4不同区域通过area0能相互通信。
1) 配置各设备的接口地址和环回接口:
(config)#interface fastEthernet x/x
(config-if)#ip address x.x.x.x x.x.x.x
(config)#interface loopback 0
(config-if)#ip address x.x.x.x x.x.x.x
2) 配置各设备所属的OSPF的相应区域:
(config)#router ospf 1
(config-router)#router-id x.x.x.x
(config-router)#network x.x.x.x x.x.x.x area x
1) 查看让不同区域相通信,现让R2设备属于area1和area2两个区域时的状况:
R2#show ip protocols
Routing Protocol is "ospf 1"
Outgoing ** filter list for all interfaces is not set
Incoming ** filter list for all interfaces is not set
Router ID 2.2.2.2
Number of areas in this router is 2. 2 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
2.2.2.0 0.0.0.255 area 1
192.168.12.0 0.0.0.255 area 1
192.168.23.0 0.0.0.255 area 2
Routing Information Sources:
Gateway Distance Last **
4.4.4.4 110 00:03:34
1.1.1.1 110 00:04:48
3.3.3.3 110 00:03:34
Distance: (default is 110)
/上面显示R2的一端接口属于area1,一端接口属于area2/
2) 查看R2能否与R1和R3建立邻居关系:
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/BDR 00:00:38 192.168.12.1 FastEthernet0/0
3.3.3.3 1 FULL/DR 00:00:32 192.168.23.3 FastEthernet1/0
/上面显示R2与R1和R3都能建立邻居关系/
3) 查看R1的路由表:
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, FastEthernet0/0
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/2] via 192.168.12.2, 00:08:24, FastEthernet0/0
/上面显示R1此时不能学习到其他区域的路由条目,因为中间没有area0作为传输区域/
4) 查看让不同区域相通信,现让R2设备属于area1和area0两个区域时的状况:
R2#show ip protocols
Routing Protocol is "ospf 1"
Outgoing ** filter list for all interfaces is not set
Incoming ** filter list for all interfaces is not set
Router ID 2.2.2.2
It is an area border router /表示R2路由器为ABR,主要作用让区域0和非区域0相连/
Number of areas in this router is 2. 2 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
2.2.2.0 0.0.0.255 area 1
192.168.12.0 0.0.0.255 area 1
192.168.23.0 0.0.0.255 area 0
Routing Information Sources:
Gateway Distance Last **
1.1.1.1 110 00:07:25
3.3.3.3 110 00:07:25
Distance: (default is 110)
/上面显示的是R2设备即属于区域0,也属于区域1。此时该路由器称为ABR/
5) 查看当R2属于两个不同区域时,是否能与这两个不同区域同时建立邻居:
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
3.3.3.3 1 FULL/DR 00:00:30 192.168.23.3 FastEthernet1/0
1.1.1.1 1 FULL/BDR 00:00:32 192.168.12.1 FastEthernet0/0
/上面显示与R1(area0)和R3(area1)都能建立邻居关系/
6) 查看R1的路由表:
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, FastEthernet0/0
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/2] via 192.168.12.2, 00:00:04, FastEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/3] via 192.168.12.2, 00:00:04, FastEthernet0/0
4.0.0.0/32 is subnetted, 1 subnets
O IA 4.4.4.4 [110/4] via 192.168.12.2, 00:00:04, FastEthernet0/0
O IA 192.168.23.0/24 [110/2] via 192.168.12.2, 00:00:05, FastEthernet0/0
O IA 192.168.34.0/24 [110/3] via 192.168.12.2, 00:00:05, FastEthernet0/0
/上面显示O IA表示该路由条目是从别的区域学习到,不在自己所属的区域1中/
7) 查看R1与R4能否相互通信:
R1#ping 192.168.34.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.34.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/66/84 ms
1) 不同区域要相互通信,中间需要area0作为传输区域。
2) O IA表示不是本区域的路由条目,而是从别的区域学习到的路由条目。
3) ABR的路由器定义:当路由器上有一个接口属于area0,另一个接口属于非area0,则此时该路由器就是ABR(area border router)。
|熊猫同学技术论坛|小黑屋| 网络工程师论坛 ( 沪ICP备09076391 )
GMT+8, 2024-4-27 11:55 , Processed in 0.062124 second(s), 18 queries , Gzip On.