HCNA-30 OSPF多区域配置
基本配置: <Huawei>system-view [Huawei]sysname r1 [r1]interface GigabitEthernet 0/0/0 [r1-GigabitEthernet0/0/0]ip address 172.16.12.1 24 [r1-GigabitEthernet0/0/0]interface GigabitEthernet0/0/1 [r1-GigabitEthernet0/0/1]ip address 172.16.13.1 24 [r1-GigabitEthernet0/0/1]interface GigabitEthernet0/0/2 [r1-GigabitEthernet0/0/2]ip address 172.16.15.1 24 [r1-GigabitEthernet0/0/2]quit [r1]display ip interface brief <Huawei>system-view [Huawei]sysname r2 [r2]interface GigabitEthernet 0/0/0 [r2-GigabitEthernet0/0/0]ip address 172.16.12.2 24 [r2-GigabitEthernet0/0/0]interface GigabitEthernet0/0/1 [r2-GigabitEthernet0/0/1]ip address 172.16.24.2 24 [r2-GigabitEthernet0/0/1]interface GigabitEthernet0/0/2 [r2-GigabitEthernet0/0/2]ip address 172.16.26.2 24 [r2-GigabitEthernet0/0/2]quit [r2]display ip interface brief <Huawei>system-view [Huawei]sysname r3 [r3]interface GigabitEthernet 0/0/0 [r3-GigabitEthernet0/0/0]ip address 172.16.13.3 24 [r3-GigabitEthernet0/0/0]interface GigabitEthernet0/0/1 [r3-GigabitEthernet0/0/1]ip address 172.16.34.3 24 [r3-GigabitEthernet0/0/1]interface GigabitEthernet0/0/2 [r3-GigabitEthernet0/0/2]ip address 172.16.35.3 24 [r3-GigabitEthernet0/0/2]interface GigabitEthernet4/0/0 [r3-GigabitEthernet4/0/0]ip address 192.168.30.1 24 [r3-GigabitEthernet4/0/0]display ip interface brief <Huawei>system-view [Huawei]sysname r4 [r4]interface GigabitEthernet 0/0/0 [r4-GigabitEthernet0/0/0]ip address 172.16.34.4 24 [r4-GigabitEthernet0/0/0]interface GigabitEthernet0/0/1 [r4-GigabitEthernet0/0/1]ip address 172.16.24.4 24 [r4-GigabitEthernet0/0/1]interface GigabitEthernet0/0/2 [r4-GigabitEthernet0/0/2]ip address 172.16.46.4 24 [r4-GigabitEthernet0/0/2]interface GigabitEthernet4/0/0 [r4-GigabitEthernet4/0/0]ip address 192.168.40.1 24 [r4-GigabitEthernet4/0/0]display ip interface brief <Huawei>system-view [Huawei]sysname r5 [r5]interface GigabitEthernet 0/0/0 [r5-GigabitEthernet0/0/0]ip address 172.16.15.5 24 [r5-GigabitEthernet0/0/0]interface GigabitEthernet0/0/1 [r5-GigabitEthernet0/0/1]ip address 172.16.35.5 24 [r5-GigabitEthernet0/0/1]interface GigabitEthernet0/0/2 [r5-GigabitEthernet0/0/2]ip address 192.168.50.1 24 [r5-GigabitEthernet0/0/2]quit [r5]display ip interface brief <Huawei>system-view [Huawei]sysname r6 [r6]interface GigabitEthernet 0/0/0 [r6-GigabitEthernet0/0/0]ip address 172.16.26.6 24 [r6-GigabitEthernet0/0/0]interface GigabitEthernet0/0/1 [r6-GigabitEthernet0/0/1]ip address 172.16.46.6 24 [r6-GigabitEthernet0/0/1]interface GigabitEthernet0/0/2 [r6-GigabitEthernet0/0/2]ip address 192.168.60.1 24 [r6-GigabitEthernet0/0/2]quit [r6]display ip interface brief
配置多区域OSPF [r1]ospf 1 //创建OSPF [r1-ospf-1]area 0 //创建0 骨干区域 [r1-ospf-1-area-0.0.0.0]network 172.16.12.00.0.0.255 //宣告参与网段 [r1-ospf-1-area-0.0.0.0]network 172.16.13.00.0.0.255 [r1-ospf-1-area-0.0.0.0]quit [r1-ospf-1]area 1 //创建区域1 [r1-ospf-1-area-0.0.0.1]network172.16.15.0 0.0.0.255 [r2]ospf 1 [r2-ospf-1]area0 [r2-ospf-1-area-0.0.0.0]network172.16.12.0 0.0.0.255 [r2-ospf-1-area-0.0.0.0]network172.16.24.0 0.0.0.255 [r2-ospf-1-area-0.0.0.0]quit [r2-ospf-1]area 2 [r2-ospf-1-area-0.0.0.2]network172.16.26.0 0.0.0.255 [r3]ospf 1 [r3-ospf-1]area0 [r3-ospf-1-area-0.0.0.0]network172.16.13.0 0.0.0.255 [r3-ospf-1-area-0.0.0.0]network172.16.34.0 0.0.0.255 [r3-ospf-1-area-0.0.0.0]network192.168.30.0 0.0.0.255 [r3-ospf-1-area-0.0.0.0]quit [r3-ospf-1]area1 [r3-ospf-1-area-0.0.0.1]network172.16.35.0 0.0.0.255 [r4]ospf 1 [r4-ospf-1]area0 [r4-ospf-1-area-0.0.0.0]network172.16.34.0 0.0.0.255 [r4-ospf-1-area-0.0.0.0]network172.16.24.0 0.0.0.255 [r4-ospf-1-area-0.0.0.0]network192.168.40.0 0.0.0.255 [r4-ospf-1-area-0.0.0.0]quit [r4-ospf-1]area2 [r4-ospf-1-area-0.0.0.2]network172.16.46.0 0.0.0.255 [r5]ospf 1 [r5-ospf-1]area1 [r5-ospf-1-area-0.0.0.1]network172.16.15.0 0.0.0.255 [r5-ospf-1-area-0.0.0.1]network172.16.35.0 0.0.0.255 [r5-ospf-1-area-0.0.0.1]network192.168.50.0 0.0.0.255 [r6]ospf 1 [r6-ospf-1]area2 [r6-ospf-1-area-0.0.0.2]network172.16.26.0 0.0.0.255 [r6-ospf-1-area-0.0.0.2]network172.16.46.0 0.0.0.255 [r6-ospf-1-area-0.0.0.2]network192.168.60.0 0.0.0.255 查看OSPF邻居状态: [r5]displayospf peer OSPF Process 1 with Router ID 172.16.15.5 Neighbors Area 0.0.0.1interface 172.16.15.5(GigabitEthernet0/0/0)'s neighbors Router ID:172.16.12.1 Address:172.16.15.1 State:Full Mode:Nbr is Slave Priority: 1 DR:172.16.15.1 BDR: 172.16.15.5 MTU: 0 Dead timerdue in 35 sec Retranstimer interval: 5 Neighbor isup for 00:04:28 Authentication Sequence: [ 0 ] Neighbors Area 0.0.0.1interface 172.16.35.5(GigabitEthernet0/0/1)'s neighbors Router ID:172.16.13.3 Address:172.16.35.3 State:Full Mode:Nbr is Slave Priority: 1 DR:172.16.35.3 BDR: 172.16.35.5 MTU: 0 Dead timerdue in 40 sec Retranstimer interval: 5 Neighbor isup for 00:04:16 AuthenticationSequence: [ 0 ] <r1>displayospf peer OSPF Process 1 with Router ID 172.16.12.1 Neighbors Area 0.0.0.0interface 172.16.12.1(GigabitEthernet0/0/0)'s neighbors Router ID:172.16.12.2 Address:172.16.12.2 State:Full Mode:Nbr is Master Priority: 1 DR:172.16.12.1 BDR: 172.16.12.2 MTU: 0 Dead timerdue in 37 sec Retranstimer interval: 5 Neighbor isup for 00:25:48 AuthenticationSequence: [ 0 ] Neighbors Area 0.0.0.0interface 172.16.13.1(GigabitEthernet0/0/1)'s neighbors Router ID:172.16.13.3 Address:172.16.13.3 State:Full Mode:Nbr is Master Priority: 1 DR:172.16.13.1 BDR: 172.16.13.3 MTU: 0 Dead timerdue in 32 sec Retranstimer interval: 5 Neighbor isup for 00:23:20 Authentication Sequence: [ 0 ] Neighbors Area 0.0.0.1interface 172.16.15.1(GigabitEthernet0/0/2)'s neighbors Router ID:172.16.15.5 Address:172.16.15.5 State:Full Mode:Nbr is Master Priority: 1 DR:172.16.15.1 BDR: 172.16.15.5 MTU: 0 Dead timerdue in 31 sec Retranstimer interval: 5 Neighbor isup for 00:19:46 AuthenticationSequence: [ 0 ] <r1>displayip routing-table protocol ospf //查看路由表中OSPF的条目 RouteFlags: R - relay, D - download to fib ------------------------------------------------------------------------------ Public routing table : OSPF Destinations : 9 Routes :11 OSPF routing table status : <Active> Destinations : 9 Routes :11 Destination/Mask Proto Pre Cost Flags NextHop Interface 172.16.24.0/24 OSPF 10 2 D 172.16.12.2 GigabitEthernet 0/0/0 172.16.26.0/24 OSPF 10 2 D 172.16.12.2 GigabitEthernet 0/0/0 172.16.34.0/24 OSPF 10 2 D 172.16.13.3 GigabitEthernet 0/0/1 172.16.35.0/24 OSPF 10 2 D 172.16.15.5 GigabitEthernet 0/0/2 172.16.46.0/24 OSPF 10 3 D 172.16.13.3 GigabitEthernet 0/0/1 OSPF 10 3 D 172.16.12.2 GigabitEthernet 0/0/0 192.168.30.0/24 OSPF 10 2 D 172.16.13.3 GigabitEthernet 0/0/1 192.168.40.0/24 OSPF 10 3 D 172.16.13.3 GigabitEthernet 0/0/1 OSPF 10 3 D 172.16.12.2 GigabitEthernet 0/0/0 192.168.50.0/24 OSPF 10 2 D 172.16.15.5 GigabitEthernet 0/0/2 192.168.60.0/24 OSPF 10 3 D 172.16.12.2 GigabitEthernet 0/0/0 OSPF routing table status : <Inactive> Destinations: 0 Routes : 0 <r5>displayospf lsdb //查看OSPF链路状态数据库信息 OSPF Process 1 with Router ID 172.16.15.5 Link State Database Area: 0.0.0.1 Type LinkState ID AdvRouter Age Len Sequence Metric Router 172.16.15.5 172.16.15.5 1437 60 80000008 1 Router 172.16.13.3 172.16.13.3 1488 36 80000005 1 Router 172.16.12.1 172.16.12.1 1503 36 80000005 1 Network 172.16.15.1 172.16.12.1 1503 32 80000002 0 Network 172.16.35.3 172.16.13.3 1488 32 80000002 0 Sum-Net 172.16.26.0 172.16.12.1 30 28 80000002 2 Sum-Net 172.16.26.0 172.16.13.3 1692 28 80000001 3 Sum-Net 172.16.34.0 172.16.12.1 1712 28 80000001 2 Sum-Net 172.16.34.0 172.16.13.3 1692 28 80000001 1 Sum-Net 172.16.13.0 172.16.12.1 357 28 80000002 1 Sum-Net 172.16.13.0 172.16.13.3 1692 28 80000001 1 Sum-Net 172.16.24.0 172.16.13.3 1598 28 80000001 2 Sum-Net 172.16.24.0 172.16.12.1 393 28 80000004 2 Sum-Net 172.16.12.0 172.16.12.1 357 28 80000002 1 Sum-Net 172.16.12.0 172.16.13.3 1692 28 80000001 2 Sum-Net 192.168.60.0 172.16.12.1 1339 28 80000001 3 Sum-Net 192.168.60.0 172.16.13.3 1339 28 80000001 3 Sum-Net 192.168.30.0 172.16.13.3 705 28 80000001 1 Sum-Net 192.168.30.0 172.16.12.1 705 28 80000001 2 Sum-Net 172.16.46.0 172.16.12.1 1575 28 80000001 3 Sum-Net 172.16.46.0 172.16.13.3 1575 28 80000001 2 Sum-Net 192.168.40.0 172.16.13.3 734 28 80000001 2 Sum-Net 192.168.40.0 172.16.12.1 734 28 80000001 3 可以看到,关于其他区域的路由条目都是通过“Sun-Net”这一LSA获得,而这类LSA是不参与本区域的SPF算法运算的。 测试PC互访全通完成。 |