ospf1/2类LSA介绍

了解1类LSA的作用和传输特点 答:用于描述一个设备的直连链路以及设备与邻居之间的互联情况 传输特点:只能区域内部传输,传输过程中LSA不产生变化,在R1,R2上看到的都一样 了解2类LSA的作用和传输特点 答:用来表达DR的管理范围 传输特点:区域内部传输,不产生变化。 了解网络类型对LSA的影响 答:是有影响的,p2p网络模式下,router详情表会说明R1和R2直接连接和距离情况 广播模式下,R5和R6都是会表达自己和DR怎么连接 了解基于LSA计算路由的过程 COST值怎么计算,下一跳ip地址怎么确定 Metric : 1 也就是COST值

案例2:熟悉1/2类LSA数据库 2.1 问题 如图配置设备 IP 和OSPF 配置区域12为点到点网络 分析区域12中的1类LSA 分析区域56中的1类和2类LSA 查看并熟悉OSPF数据库

[R2]ospf 1 router-id 2.2.2.2 /ospf协议1 路由id 2.2.2.2 [R2-ospf-1]area 0 //区域0 [R2-ospf-1-area-0.0.0.0]network 192.168.23.0 0.0.0.255 宣告网段23.0 [R2-ospf-1-area-0.0.0.0]q /后退 [R2-ospf-1]area 12 //区域12 [R2-ospf-1-area-0.0.0.12]network 192.168.12.0 0.0.0.255 //宣告网段12.0 [R2-ospf-1-area-0.0.0.12]q [R2-ospf-1]q [R2]dis ospf peer brief //查询ospf 邻接状态 [R2]display ospf lsdb //查询ospf 链路状态数据库 [R1]dis ospf lsdb router 1.1.1.1 //查询ospf 链路状态数据库路由1.1.1.1 详情

[R1-GigabitEthernet0/0/2]ip add 192.168.1.1 24 [R1]ospf 1 [R1-ospf-1]area 12 [R1-ospf-1-area-0.0.0.12]network 192.168.1.0 0.0.0.255 增加PC1 1.0网段 修改接口ip 在区域12 宣告网址 [R1]dis ip routing-table protocol ospf /查看ospf协议路由表
R6同理添加

验证 R1上查看1类LSA

R6上查看1类/2类LSA 2类LSA表达DR的管理范围 R1添加1.0网段和pc1 R2添加2网段和PC2 最后PC1和PC2可以互通

2 案例2:熟悉1/2类LSA数据库 2.1 问题 如图配置设备 IP 和OSPF 配置区域12为点到点网络 分析区域12中的1类LSA 分析区域56中的1类和2类LSA 查看并熟悉OSPF数据库 2.2 方案 搭建实验环境,如图-2所示。

图-2

2.3 步骤 实现此案例需要按照如下步骤进行。

1)配置IP地址,设置OSPF区域

<Huawei>undo terminal monitor <Huawei>system-view [Huawei]sysname R1 [R1]interface GigabitEthernet 0/0/0 [R1-GigabitEthernet0/0/0]ip add 192.168.12.1 24 [R1-GigabitEthernet0/0/0]quit [R1]ospf 1 router-id 1.1.1.1 [R1-ospf-1]area 12
[R1-ospf-1-area-0.0.0.12]network 192.168.12.0 0.0.0.255 [R1-ospf-1-area-0.0.0.12]quit <Huawei>undo terminal monitor <Huawei>system-view [Huawei]sysname R2 [R2]interface GigabitEthernet 0/0/1 [R2-GigabitEthernet0/0/1]ip add 192.168.12.2 24 [R2-GigabitEthernet0/0/1]quit [R2]interface GigabitEthernet 0/0/0 [R2-GigabitEthernet0/0/0]ip add 192.168.23.2 24 [R2-GigabitEthernet0/0/0]quit [R2]ospf 1 router-id 2.2.2.2 [R2-ospf-1]area 12
[R2-ospf-1-area-0.0.0.12]network 192.168.12.0 0.0.0.255 [R2-ospf-1-area-0.0.0.12]quit [R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 192.168.23.0 0.0.0.255 [R2-ospf-1-area-0.0.0.0]quit <Huawei>undo terminal monitor <Huawei>system-view [Huawei]sysname R3 [R3]interface GigabitEthernet 0/0/1 [R3-GigabitEthernet0/0/1]ip add 192.168.23.3 24 [R3-GigabitEthernet0/0/1]quit [R3]interface GigabitEthernet 0/0/0 [R3-GigabitEthernet0/0/0]ip add 192.168.34.3 24 [R3-GigabitEthernet0/0/0]quit [R3]ospf 1 router-id 3.3.3.3 [R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 192.168.23.0 0.0.0.255 [R3-ospf-1-area-0.0.0.0]network 192.168.34.0 0.0.0.255 [R3-ospf-1-area-0.0.0.0]quit <Huawei>undo terminal monitor <Huawei>system-view [Huawei]sysname R4 [R4]interface GigabitEthernet 0/0/1 [R4-GigabitEthernet0/0/1]ip add 192.168.34.4 24 [R4-GigabitEthernet0/0/1]quit [R4]interface GigabitEthernet 0/0/0 [R4-GigabitEthernet0/0/0]ip add 192.168.45.4 24 [R4-GigabitEthernet0/0/0]quit [R4]ospf 1 router-id 4.4.4.4 [R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 192.168.45.0 0.0.0.255 [R4-ospf-1-area-0.0.0.0]network 192.168.34.0 0.0.0.255 [R4-ospf-1-area-0.0.0.0]quit <Huawei>undo terminal monitor <Huawei>system-view [Huawei]sysname R5 [R5]interface GigabitEthernet 0/0/1 [R5-GigabitEthernet0/0/1]ip add 192.168.45.5 24 [R5-GigabitEthernet0/0/1]quit [R5]interface GigabitEthernet 0/0/0 [R5-GigabitEthernet0/0/0]ip add 192.168.56.5 24 [R5-GigabitEthernet0/0/0]quit [R5]ospf 1 router-id 5.5.5.5 [R5-ospf-1]area 56
[R5-ospf-1-area-0.0.0.56]network 192.168.56.0 0.0.0.255 [R5-ospf-1-area-0.0.0.56]quit [R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 192.168.45.0 0.0.0.255 [R5-ospf-1-area-0.0.0.0]quit <Huawei>undo terminal monitor <Huawei>system-view [Huawei]sysname R6 [R6]interface GigabitEthernet 0/0/1 [R6-GigabitEthernet0/0/1]ip add 192.168.56.6 24 [R6-GigabitEthernet0/0/1]quit [R6]ospf 1 router-id 6.6.6.6 [R6-ospf-1]area 56
[R6-ospf-1-area-0.0.0.56]network 192.168.56.0 0.0.0.255 [R6-ospf-1-area-0.0.0.56]quit 2)修改区域12的网络为点到点网络

[R1]interface GigabitEthernet 0/0/0 [R1-GigabitEthernet0/0/0]ospf network-type p2p [R2]interface GigabitEthernet 0/0/1 [R2-GigabitEthernet0/0/1]ospf network-type p2p 3)查看 区域12 中的1类LSA

[R1]display ospf lsdb router 1.1.1.1 OSPF Process 1 with Router ID 1.1.1.1 Area: 0.0.0.12 Link State Database Type : Router Ls id : 1.1.1.1 Adv rtr : 1.1.1.1
Ls age : 10 Len : 48 Options : E
seq# : 80000008 chksum : 0x89b6 Link count: 2

  • Link ID: 2.2.2.2
    Data : 192.168.12.1 Link Type: P-2-P
    Metric : 1
  • Link ID: 192.168.12.0 Data : 255.255.255.0 Link Type: StubNet
    Metric : 1 Priority : Low [R1]display ospf lsdb router 2.2.2.2 OSPF Process 1 with Router ID 1.1.1.1 Area: 0.0.0.12 Link State Database Type : Router Ls id : 2.2.2.2 Adv rtr : 2.2.2.2
    Ls age : 48 Len : 48 Options : ABR E
    seq# : 8000000b chksum : 0x2611 Link count: 2
  • Link ID: 1.1.1.1
    Data : 192.168.12.2 Link Type: P-2-P
    Metric : 1
  • Link ID: 192.168.12.0 Data : 255.255.255.0 Link Type: StubNet
    Metric : 1 Priority : Low 4)查看区域56中的1类LSA和2类LSA

<R6>display ospf lsdb router 5.5.5.5 OSPF Process 1 with Router ID 6.6.6.6 Area: 0.0.0.56 Link State Database Type : Router Ls id : 5.5.5.5 Adv rtr : 5.5.5.5
Ls age : 516 Len : 36 Options : ABR E
seq# : 80000006 chksum : 0x5186 Link count: 1

  • Link ID: 192.168.56.5 Data : 192.168.56.5 Link Type: TransNet
    Metric : 1 <R6>display ospf lsdb router 6.6.6.6 OSPF Process 1 with Router ID 6.6.6.6 Area: 0.0.0.56 Link State Database Type : Router Ls id : 6.6.6.6 Adv rtr : 6.6.6.6
    Ls age : 540 Len : 36 Options : E
    seq# : 80000003 chksum : 0x16bc Link count: 1
  • Link ID: 192.168.56.5 Data : 192.168.56.6 Link Type: TransNet
    Metric : 1 <R6>display ospf lsdb network 192.168.56.5 OSPF Process 1 with Router ID 6.6.6.6 Area: 0.0.0.56 Link State Database Type : Network Ls id : 192.168.56.5 Adv rtr : 5.5.5.5
    Ls age : 559 Len : 32 Options : E
    seq# : 80000002 chksum : 0x72ff Net mask : 255.255.255.0 Priority : Low Attached Router 5.5.5.5 Attached Router 6.6.6.6

1 案例1:熟悉OSPF数据库 1.1 问题 如图配置设备 IP 和OSPF 查看并熟悉OSPF数据库 1.2 方案 搭建实验环境,如图-1所示。

图-1

1.3 步骤 实现此案例需要按照如下步骤进行。

1)配置IP地址,设置OSPF区域

<Huawei>undo terminal monitor <Huawei>system-view [Huawei]sysname R1 [R1]interface GigabitEthernet 0/0/0 [R1-GigabitEthernet0/0/0]ip add 192.168.12.1 24 [R1-GigabitEthernet0/0/0]quit [R1]ospf 1 router-id 1.1.1.1 [R1-ospf-1]area 12
[R1-ospf-1-area-0.0.0.12]network 192.168.12.0 0.0.0.255 [R1-ospf-1-area-0.0.0.12]quit <Huawei>undo terminal monitor <Huawei>system-view [Huawei]sysname R2 [R2]interface GigabitEthernet 0/0/1 [R2-GigabitEthernet0/0/1]ip add 192.168.12.2 24 [R2-GigabitEthernet0/0/1]quit [R2]interface GigabitEthernet 0/0/0 [R2-GigabitEthernet0/0/0]ip add 192.168.23.2 24 [R2-GigabitEthernet0/0/0]quit [R2]ospf 1 router-id 2.2.2.2 [R2-ospf-1]area 12
[R2-ospf-1-area-0.0.0.12]network 192.168.12.0 0.0.0.255 [R2-ospf-1-area-0.0.0.12]quit [R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 192.168.23.0 0.0.0.255 [R2-ospf-1-area-0.0.0.0]quit <Huawei>undo terminal monitor <Huawei>system-view [Huawei]sysname R3 [R3]interface GigabitEthernet 0/0/1 [R3-GigabitEthernet0/0/1]ip add 192.168.23.3 24 [R3-GigabitEthernet0/0/1]quit [R3]interface GigabitEthernet 0/0/0 [R3-GigabitEthernet0/0/0]ip add 192.168.34.3 24 [R3-GigabitEthernet0/0/0]quit [R3]ospf 1 router-id 3.3.3.3 [R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 192.168.23.0 0.0.0.255 [R3-ospf-1-area-0.0.0.0]network 192.168.34.0 0.0.0.255 [R3-ospf-1-area-0.0.0.0]quit <Huawei>undo terminal monitor <Huawei>system-view [Huawei]sysname R4 [R4]interface GigabitEthernet 0/0/1 [R4-GigabitEthernet0/0/1]ip add 192.168.34.4 24 [R4-GigabitEthernet0/0/1]quit [R4]interface GigabitEthernet 0/0/0 [R4-GigabitEthernet0/0/0]ip add 192.168.45.4 24 [R4-GigabitEthernet0/0/0]quit [R4]ospf 1 router-id 4.4.4.4 [R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 192.168.45.0 0.0.0.255 [R4-ospf-1-area-0.0.0.0]network 192.168.34.0 0.0.0.255 [R4-ospf-1-area-0.0.0.0]quit <Huawei>undo terminal monitor <Huawei>system-view [Huawei]sysname R5 [R5]interface GigabitEthernet 0/0/1 [R5-GigabitEthernet0/0/1]ip add 192.168.45.5 24 [R5-GigabitEthernet0/0/1]quit [R5]interface GigabitEthernet 0/0/0 [R5-GigabitEthernet0/0/0]ip add 192.168.56.5 24 [R5-GigabitEthernet0/0/0]quit [R5]ospf 1 router-id 5.5.5.5 [R5-ospf-1]area 56
[R5-ospf-1-area-0.0.0.56]network 192.168.56.0 0.0.0.255 [R5-ospf-1-area-0.0.0.56]quit [R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 192.168.45.0 0.0.0.255 [R5-ospf-1-area-0.0.0.0]quit <Huawei>undo terminal monitor <Huawei>system-view [Huawei]sysname R6 [R6]interface GigabitEthernet 0/0/1 [R6-GigabitEthernet0/0/1]ip add 192.168.56.6 24 [R6-GigabitEthernet0/0/1]quit [R6]ospf 1 router-id 6.6.6.6 [R6-ospf-1]area 56
[R6-ospf-1-area-0.0.0.56]network 192.168.56.0 0.0.0.255 [R6-ospf-1-area-0.0.0.56]quit 2)查看 R1 的 OSPF 数据库

[R1]display ospf lsdb OSPF Process 1 with Router ID 1.1.1.1 Link State Database Area: 0.0.0.12 Type LinkState ID AdvRouter Age Len Sequence Metric Router 2.2.2.2 2.2.2.2 78 36 80000005 1 Router 1.1.1.1 1.1.1.1 78 36 80000004 1 Network 192.168.12.2 2.2.2.2 79 32 80000002 0 Sum-Net 192.168.45.0 2.2.2.2 71 28 80000001 3 Sum-Net 192.168.23.0 2.2.2.2 116 28 80000001 1 Sum-Net 192.168.56.0 2.2.2.2 36 28 80000001 4 Sum-Net 192.168.34.0 2.2.2.2 71 28 80000001 2 3)查看 R2(ABR)的数据库

[R2]display ospf lsdb OSPF Process 1 with Router ID 2.2.2.2 Link State Database Area: 0.0.0.0 Type LinkState ID AdvRouter Age Len Sequence Metric Router 4.4.4.4 4.4.4.4 88 48 80000007 1 Router 2.2.2.2 2.2.2.2 122 36 80000004 1 Router 5.5.5.5 5.5.5.5 87 36 80000004 1 Router 3.3.3.3 3.3.3.3 120 48 80000006 1 Network 192.168.23.3 3.3.3.3 120 32 80000002 0 Network 192.168.34.3 3.3.3.3 124 32 80000002 0 Network 192.168.45.5 5.5.5.5 87 32 80000002 0 Sum-Net 192.168.56.0 5.5.5.5 126 28 80000001 1 Sum-Net 192.168.12.0 2.2.2.2 167 28 80000001 1 Area: 0.0.0.12 Type LinkState ID AdvRouter Age Len Sequence Metric Router 2.2.2.2 2.2.2.2 129 36 80000005 1 Router 1.1.1.1 1.1.1.1 131 36 80000004 1 Network 192.168.12.2 2.2.2.2 130 32 80000002 0 Sum-Net 192.168.45.0 2.2.2.2 121 28 80000001 3 Sum-Net 192.168.23.0 2.2.2.2 167 28 80000001 1 Sum-Net 192.168.56.0 2.2.2.2 86 28 80000001 4 Sum-Net 192.168.34.0 2.2.2.2 121 28 80000001 2 4)查看R3(骨干区域设备)的OSPF数据库

[R3]display ospf lsdb OSPF Process 1 with Router ID 3.3.3.3 Link State Database Area: 0.0.0.0 Type LinkState ID AdvRouter Age Len Sequence Metric Router 4.4.4.4 4.4.4.4 140 48 80000007 1 Router 2.2.2.2 2.2.2.2 175 36 80000004 1 Router 5.5.5.5 5.5.5.5 139 36 80000004 1 Router 3.3.3.3 3.3.3.3 172 48 80000006 1 Network 192.168.23.3 3.3.3.3 172 32 80000002 0 Network 192.168.34.3 3.3.3.3 175 32 80000002 0 Network 192.168.45.5 5.5.5.5 139 32 80000002 0 Sum-Net 192.168.56.0 5.5.5.5 178 28 80000001 1 Sum-Net 192.168.12.0 2.2.2.2 220 28 80000001 1