多区域OSPF配置

多区域OSPF配置

拓扑如下

 

 ,


Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#ho R1
R1(config)#int fastEthernet 0/0
R1(config-if)#ip add 12.0.0.1 255.255.255.0
R1(config-if)#no shu
R1(config-if)#exit
R1(config)#int lo 1
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#no shu
R1(config-if)#exit
R1(config)#router ospf 1
R1(config-router)#network  12.0.0.1 0.0.0.0 area 1
R1(config-router)#net 1.1.1.1 0.0.0.0 area 1
R1(config-router)#exit
R1(config)#exit

查看R1的OSPF邻居信息
R1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           1   FULL/BDR        00:00:33    12.0.0.2        FastEthernet0/0

查看OSPF的路由
R1#sho ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       i - IS-IS, 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

     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback1
     2.0.0.0/32 is subnetted, 1 subnets
O IA    2.2.2.2 [110/2] via 12.0.0.2, 00:08:30, FastEthernet0/0
     3.0.0.0/32 is subnetted, 1 subnets
O IA    3.3.3.3 [110/3] via 12.0.0.2, 00:06:40, FastEthernet0/0
     4.0.0.0/32 is subnetted, 1 subnets
O IA    4.4.4.4 [110/4] via 12.0.0.2, 00:00:48, FastEthernet0/0
     12.0.0.0/24 is subnetted, 1 subnets
C       12.0.0.0 is directly connected, FastEthernet0/0
     23.0.0.0/24 is subnetted, 1 subnets
O IA    23.0.0.0 [110/2] via 12.0.0.2, 00:08:40, FastEthernet0/0
     34.0.0.0/24 is subnetted, 1 subnets
O IA    34.0.0.0 [110/3] via 12.0.0.2, 00:06:19, FastEthernet0/0

查看R1的链路状态数据库
R1#sho ip ospf database
            OSPF Router with ID (1.1.1.1) (Process ID 1)

                Router Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         555         0x80000003 0x006caf 2
2.2.2.2         2.2.2.2         550         0x80000003 0x0051d5 1

                Net Link States (Area 1)
Link ID         ADV Router      Age         Seq#       Checksum
12.0.0.1        1.1.1.1         555         0x80000001 0x00a27c

                Summary Net Link States (Area 1)
Link ID         ADV Router      Age         Seq#       Checksum
23.0.0.0        2.2.2.2         540         0x80000001 0x002b14
2.2.2.2         2.2.2.2         530         0x80000002 0x00f854
3.3.3.3         2.2.2.2         421         0x80000003 0x00d274
34.0.0.0        2.2.2.2         400         0x80000004 0x009f90
4.4.4.4         2.2.2.2         73          0x80000005 0x00aa95
R1#

 

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#ho R2
R2(config)#int f0/1
R2(config-if)#ip add 12.0.0.2 255.255.255.0
R2(config-if)#no shu
R2(config-if)#exit
R2(config)#int fastEthernet 0/0
R2(config-if)#ip add 23.0.0.2 255.255.255.0
R2(config-if)#no shu
R2(config)#int lo 0
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config-if)#exit
R2(config)#router ospf 1
R2(config-router)#net 12.0.0.2 0.0.0.0 a 1
R2(config-router)#net 23.0.0.2 0.0.0.0 area 0
R2(config-router)#net 2.2.2.2 0.0.0.0 a 0
R2(config-router)#exit
R2(config)#exit

R2#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/DR         00:00:39    12.0.0.1        FastEthernet0/1
3.3.3.3           1   FULL/DR         00:00:39    23.0.0.3        FastEthernet0/0


R2#sho ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       i - IS-IS, 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

     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/2] via 12.0.0.1, 00:14:02, FastEthernet0/1
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/2] via 23.0.0.3, 00:11:56, FastEthernet0/0
     4.0.0.0/32 is subnetted, 1 subnets
O IA    4.4.4.4 [110/3] via 23.0.0.3, 00:06:04, FastEthernet0/0
     12.0.0.0/24 is subnetted, 1 subnets
C       12.0.0.0 is directly connected, FastEthernet0/1
     23.0.0.0/24 is subnetted, 1 subnets
C       23.0.0.0 is directly connected, FastEthernet0/0
     34.0.0.0/24 is subnetted, 1 subnets
O IA    34.0.0.0 [110/2] via 23.0.0.3, 00:11:35, FastEthernet0/0


R2#sho ip ospf database
            OSPF Router with ID (2.2.2.2) (Process ID 1)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
2.2.2.2         2.2.2.2         765         0x80000003 0x005e97 2
3.3.3.3         3.3.3.3         708         0x80000004 0x007077 2

                Net Link States (Area 0)
Link ID         ADV Router      Age         Seq#       Checksum
23.0.0.3        3.3.3.3         765         0x80000001 0x0007fa

                Summary Net Link States (Area 0)
Link ID         ADV Router      Age         Seq#       Checksum
12.0.0.0        2.2.2.2         839         0x80000001 0x00ba8f
1.1.1.1         2.2.2.2         839         0x80000002 0x00311f
34.0.0.0        3.3.3.3         703         0x80000001 0x007db2
4.4.4.4         3.3.3.3         372         0x80000002 0x0088b7

                Router Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         849         0x80000003 0x006caf 2
2.2.2.2         2.2.2.2         844         0x80000003 0x0051d5 1

                Net Link States (Area 1)
Link ID         ADV Router      Age         Seq#       Checksum
12.0.0.1        1.1.1.1         849         0x80000001 0x00a27c

                Summary Net Link States (Area 1)
Link ID         ADV Router      Age         Seq#       Checksum
23.0.0.0        2.2.2.2         835         0x80000001 0x002b14
2.2.2.2         2.2.2.2         825         0x80000002 0x00f854
3.3.3.3         2.2.2.2         716         0x80000003 0x00d274
34.0.0.0        2.2.2.2         694         0x80000004 0x009f90
4.4.4.4         2.2.2.2         368         0x80000005 0x00aa95
R2#

 

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#ho R3
R3(config)#int fastEthernet 0/1
R3(config-if)#ip add 23.0.0.3 255.255.255.0
R3(config-if)#no shu
R3(config-if)#exit
R3(config)#int fastEthernet 0/0
R3(config-if)#ip add 34.0.00.3 255.255.255.0
R3(config-if)#no shu
R3(config-if)#exit
R3(config)#int lo 0
R3(config-if)#ip ad 3.3.3.3 255.255.255.0
R3(config-if)#no shu
R3(config-if)#exit
R3(config)#router ospf 1
R3(config-router)#net 23.0.0.3 0.0.0.0 a 0
R3(config-router)#network 3.3.3.3 0.0.0.0 a 0
R3(config-router)#network 34.0.0.3 0.0.0.0 a 2
R3(config-router)#exit
R3(config)#exit


R3#sho ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           1   FULL/BDR        00:00:38    23.0.0.2        FastEthernet0/1
4.4.4.4           1   FULL/BDR        00:00:33    34.0.0.4        FastEthernet0/0


R3#sho ip ospf database
            OSPF Router with ID (3.3.3.3) (Process ID 1)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
2.2.2.2         2.2.2.2         927         0x80000003 0x005e97 2
3.3.3.3         3.3.3.3         870         0x80000004 0x007077 2

                Net Link States (Area 0)
Link ID         ADV Router      Age         Seq#       Checksum
23.0.0.3        3.3.3.3         927         0x80000001 0x0007fa

                Summary Net Link States (Area 0)
Link ID         ADV Router      Age         Seq#       Checksum
12.0.0.0        2.2.2.2         1001        0x80000001 0x00ba8f
1.1.1.1         2.2.2.2         1001        0x80000002 0x00311f
34.0.0.0        3.3.3.3         865         0x80000001 0x007db2
4.4.4.4         3.3.3.3         534         0x80000002 0x0088b7

                Router Link States (Area 2)

Link ID         ADV Router      Age         Seq#       Checksum Link count
3.3.3.3         3.3.3.3         539         0x80000002 0x00b63a 1
4.4.4.4         4.4.4.4         539         0x80000004 0x0003c2 2

                Net Link States (Area 2)
Link ID         ADV Router      Age         Seq#       Checksum
34.0.0.3        3.3.3.3         539         0x80000001 0x000cd5

                Summary Net Link States (Area 2)
Link ID         ADV Router      Age         Seq#       Checksum
23.0.0.0        3.3.3.3         866         0x80000001 0x000d2e
3.3.3.3         3.3.3.3         866         0x80000002 0x00ac98
2.2.2.2         3.3.3.3         866         0x80000003 0x00e264
12.0.0.0        3.3.3.3         866         0x80000004 0x00a0a1
1.1.1.1         3.3.3.3         866         0x80000005 0x001731


R3#sho ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       i - IS-IS, 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

     1.0.0.0/32 is subnetted, 1 subnets
O IA    1.1.1.1 [110/3] via 23.0.0.2, 00:15:42, FastEthernet0/1
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/2] via 23.0.0.2, 00:15:42, FastEthernet0/1
     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Loopback0
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/2] via 34.0.0.4, 00:09:09, FastEthernet0/0
     12.0.0.0/24 is subnetted, 1 subnets
O IA    12.0.0.0 [110/2] via 23.0.0.2, 00:15:42, FastEthernet0/1
     23.0.0.0/24 is subnetted, 1 subnets
C       23.0.0.0 is directly connected, FastEthernet0/1
     34.0.0.0/24 is subnetted, 1 subnets
C       34.0.0.0 is directly connected, FastEthernet0/0
R3#


Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#ho R4
R4(config)#interface FastEthernet0/1
R4(config-if)#ip add 34.0.0.4 255.255.255.0
R4(config-if)#no shutdown
R4(config-if)#exit
R4(config)#router ospf 1
R4(config-router)#network  34.0.0.4 0.0.0.0 a 2
R4(config-router)#net 4.4.4.4 0.0.0.0 a 2
R4(config-router)#exit
R4(config)#exit

R4#sho ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           1   FULL/DR         00:00:37    34.0.0.3        FastEthernet0/1

R4#sho ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       i - IS-IS, 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

     1.0.0.0/32 is subnetted, 1 subnets
O IA    1.1.1.1 [110/4] via 34.0.0.3, 00:00:18, FastEthernet0/1
     2.0.0.0/32 is subnetted, 1 subnets
O IA    2.2.2.2 [110/3] via 34.0.0.3, 00:00:18, FastEthernet0/1
     3.0.0.0/32 is subnetted, 1 subnets
O IA    3.3.3.3 [110/2] via 34.0.0.3, 00:00:18, FastEthernet0/1
     4.0.0.0/24 is subnetted, 1 subnets
C       4.4.4.0 is directly connected, Loopback0
     12.0.0.0/24 is subnetted, 1 subnets
O IA    12.0.0.0 [110/3] via 34.0.0.3, 00:00:18, FastEthernet0/1
     23.0.0.0/24 is subnetted, 1 subnets
O IA    23.0.0.0 [110/2] via 34.0.0.3, 00:00:18, FastEthernet0/1
     34.0.0.0/24 is subnetted, 1 subnets
C       34.0.0.0 is directly connected, FastEthernet0/1


R4#sho ip ospf database
            OSPF Router with ID (4.4.4.4) (Process ID 1)

                Router Link States (Area 2)

Link ID         ADV Router      Age         Seq#       Checksum Link count
4.4.4.4         4.4.4.4         788         0x80000004 0x0003c2 2
3.3.3.3         3.3.3.3         788         0x80000002 0x00b63a 1

                Net Link States (Area 2)
Link ID         ADV Router      Age         Seq#       Checksum
34.0.0.3        3.3.3.3         788         0x80000001 0x000cd5

                Summary Net Link States (Area 2)
Link ID         ADV Router      Age         Seq#       Checksum
23.0.0.0        3.3.3.3         1115        0x80000001 0x000d2e
3.3.3.3         3.3.3.3         1115        0x80000002 0x00ac98
2.2.2.2         3.3.3.3         1115        0x80000003 0x00e264
12.0.0.0        3.3.3.3         1115        0x80000004 0x00a0a1
1.1.1.1         3.3.3.3         1115        0x80000005 0x001731
R4#

 

实验小结:OSPF的多区域配置,通过对每个路由器路由表,OSPF邻居,OSPF数据库的查看,对OSPFDR和BDR选举,个区域路由信息,以及OSPF有了更深刻的认识。

你可能感兴趣的:(配置,职场,休闲,ospf,多区域)