多区域 ospf
一、 实验目的
学习 ospf 的基本配置,了解 ospf 的工作原理, ABR,ASBR 的汇总,以及 DR BDR 的选举。
二、 拓扑结构
多区域ospf实验_第1张图片
三、 实验步骤
1.       准备工作
2.       基本配置
a)         基本接口的的配置
b)        测试
Singapore ping 192.168.224.1
sanjose  ping 192.168.1.1
结论:线路连接没有问题
3.       配置 ospf
a)         Sanjose3
Router ospf 1
network 192.168.3.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.255 area 0
network 192.168.224.1 0.0.0.3 area 51
b sanjose1
    router ospf 1
 network 192.168.1.0 0.0.0.255 area 0
 network 192.168.64.0 0.0.63.255 area 1
        c Singapore
                     router ospf 2
                    network 192.168.224.0 0.0.0.3 area 51
4.       测试 ospf
a)         Singapore ping 192.168.3.1 ping 192.168.1.1
b)        sanjose1 ping 192.168.3.1 ping 192.168.224.2
c)         show ip ospf
 snajose1#show ip ospf
 Routing Process "ospf 1" with ID 192.168.112.1
 Start time: 00:36:34.336, Time elapsed: 00:04:33.248
 Supports only single TOS(TOS0) routes
 Supports opaque LSA
 Supports Link-local Signaling (LLS)
 Supports area transit capability
 It is an area border router
sanjose3 sanjose1 ABR
              d show ip ospf neighbor detail
                     sanjose3#sho ip ospf nei detail
 Neighbor 192.168.112.1, interface address 192.168.1.1
    In the area 0 via interface FastEthernet1/0
    Neighbor priority is 1, State is FULL, 6 state changes
    DR is 192.168.1.3 BDR is 192.168.1.1
    Options is 0x52
    LLS Options is 0x1 (LR)
    Dead timer due in 00:00:31
    Neighbor is up for 00:13:48
    Index 1/1, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec
 Neighbor 192.168.252.1, interface address 192.168.224.2
    In the area 51 via interface Serial0/1
    Neighbor priority is 0, State is FULL, 6 state changes
    DR is 0.0.0.0 BDR is 0.0.0.0
    Options is 0x52
    LLS Options is 0x1 (LR)
    Dead timer due in 00:00:36
    Neighbor is up for 00:11:52
    Index 1/2, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec
结论:区域 0 DR BDR 因为区域 0 是广播式的以太网 区域 51 DR BDR 因为区域 51 是点到点的网络
5.       ospf 的汇总
a)         汇总原因
Singapore 的路由条目过多可进行汇总节省 cpu 的开销
 
     192.168.224.0/30 is subnetted, 1 subnets
C       192.168.224.0 is directly connected, Serial0/1
C    192.168.240.0/24 is directly connected, Loopback1
C    192.168.244.0/24 is directly connected, Loopback2
     192.168.64.0/32 is subnetted, 1 subnets
O IA    192.168.64.1 [110/66] via 192.168.224.1, 00:22:26, Serial0/1
     192.168.80.0/32 is subnetted, 1 subnets
O IA    192.168.80.1 [110/66] via 192.168.224.1, 00:22:26, Serial0/1
     192.168.96.0/32 is subnetted, 1 subnets
O IA    192.168.96.1 [110/66] via 192.168.224.1, 00:22:26, Serial0/1
C    192.168.248.0/24 is directly connected, Loopback3
     192.168.112.0/32 is subnetted, 1 subnets
O IA    192.168.112.1 [110/66] via 192.168.224.1, 00:22:26, Serial0/1
O IA 192.168.1.0/24 [110/65] via 192.168.224.1, 00:24:13, Serial0/1
C    192.168.252.0/24 is directly connected, Loopback0
     192.168.3.0/32 is subnetted, 1 subnets
O IA    192.168.3.1 [110/65] via 192.168.224.1, 00:24:13, Serial0/1
              b )汇总
                     snajose1(config)#router ospf 1 
                     snajose1(config-router)#area 1 range 192.168.64.0 255.255.192.0
              c ASBR 的配置
                     singapore(config)#ip route 192.168.248.0 255.255.255.0 null0
singapore(config)#router ospf 1
singapore(config-router)#redistribute static subnets 
                     singapore#show ip ospf
 Routing Process "ospf 1" with ID 192.168.248.1
 Start time: 01:21:27.320, Time elapsed: 01:09:01.136
 Supports only single TOS(TOS0) routes
 Supports opaque LSA
 Supports Link-local Signaling (LLS)
 Supports area transit capability
 It is an autonomous system boundary router
Singapore 成为 ASBR
                  sanjose3#sho ip route
                   Gateway of last resort is not set
     192.168.224.0/30 is subnetted, 1 subnets
C       192.168.224.0 is directly connected, Serial0/1
O E2 192.168.248.0/24 [110/20] via 192.168.224.2, 00:00:47, Serial0/1
C    192.168.1.0/24 is directly connected, FastEthernet1/0
C    192.168.3.0/24 is directly connected, Loopback0
O IA 192.168.64.0/18 [110/2] via 192.168.1.1, 00:00:47, FastEthernet1/0
                     sanjose1
                            O E2 192.168.248.0/24 [110/20] via 192.168.1.3, 00:04:49, FastEthernet1/0
问题: sanjose3 sanjose1 到达 192.168.248.0/24 的开销值相同但实际上 sanjose3 的开销要小
解决方案:
singapore(config)#router ospf 1
singapore(config-router)#redistribute static  subnets metric-type 1
     6 ASBR 的汇总
singapore(config)#ip route 192.168.240.0 255.255.255.252 null0
singapore(config)#ip route 192.168.244.0 255.255.255.0 null0 
singapore(config)#ip route 192.168.252.0 255.255.255.0 null0
singapore(config-router)#summary-address 192.168.240.0 255.255.240.0
结果 :
sanjose1
O E1 192.168.240.0/20 [110/85] via 192.168.1.3, 00:00:08, FastEthernet1/0
sanjose3
O E1 192.168.248.0/24 [110/84] via 192.168.224.2, 00:00:55, Serial0/1
6. 默认路由的配置
       snajose1(config)#int lo 5
snajose1(config-if)#ip add 10.0.0.6 255.255.255.255    
snajose1(config-if)#router ospf 1
snajose1(config-router)#default-information originate always
结果:
sanjose3 show ip route
O*E2 0.0.0.0/0 [110/1] via 192.168.1.1, 00:00:55, FastEthernet1/0
四:实验总结
       学习掌握多区域 ospf 的工作原理配置,掌握 DR BDR 的选举, ABR ASBR
       概念,以及在 ABR ASBR 的汇总, ospf 的默认路由的宣告。