5. 12类LSA和SPF计算路由
Posted j-chao
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了5. 12类LSA和SPF计算路由相关的知识,希望对你有一定的参考价值。
1.DR/BDR
1.1 采用默认的NBMA,同时HUB设备(R1)成为DR,路由完整,路由的下一跳是分支的IP地址,但是由于分支间没有地址映射,所以无法通信
dis fr map-info
1.2 采用广播,自动发现邻居,照样要使得R1成为DR
[R4-Serial1/0/0]dis ip rou pro ospf //无论是NBMA还是广播,都需要让HUB成为DR,路由的下一跳都是其他分支,所有数据都无法通信
Route Flags: R - relay, D - download to fib
Public routing table : OSPF
Destinations : 8 Routes : 8
OSPF routing table status : <Active>
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.1.30.0/24 OSPF 10 49 D 10.1.34.3 Serial2/0/0
10.1.35.0/24 OSPF 10 49 D 10.1.1.5 Serial1/0/0
10.1.56.0/24 OSPF 10 96 D 10.1.1.5 Serial1/0/0
10.10.10.10/32 OSPF 10 49 D 10.1.34.3 Serial2/0/0
11.1.1.1/32 OSPF 10 48 D 10.1.1.1 Serial1/0/0
33.1.1.1/32 OSPF 10 49 D 10.1.1.5 Serial1/0/0
55.1.1.1/32 OSPF 10 48 D 10.1.1.5 Serial1/0/0
66.1.1.1/32 OSPF 10 96 D 10.1.1.5 Serial1/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
[R4-Serial1/0/0]ping 55.1.1.1
PING 55.1.1.1: 56 data bytes, press CTRL_C to break
Request time out
Request time out
--- 55.1.1.1 ping statistics ---
2 packet(s) transmitted
0 packet(s) received
100.00% packet loss
[R4-Serial1/0/0]ping 10.1.1.5
PING 10.1.1.5: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 10.1.1.5 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
//解决方案:
1. 可以购买链路(增加fr映射)
2. 从技术角度去考虑可以采用p2mp
1.3 采用p2mp
1.3.1 优势:
-
不需要单播发现邻居
-
**不需要DR/BDR **
-
路由的下一跳
[R5-Serial1/0/0]dis ip rou pro ospf
Route Flags: R - relay, D - download to fib
Public routing table : OSPF
Destinations : 9 Routes : 9
OSPF routing table status : <Active>
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.1.1.4/32 OSPF 10 96 D 10.1.1.1 Serial1/0/0
10.1.30.0/24 OSPF 10 145 D 10.1.1.1 Serial1/0/0
10.1.34.0/24 OSPF 10 144 D 10.1.1.1 Serial1/0/0
10.10.10.10/32 OSPF 10 145 D 10.1.1.1 Serial1/0/0
11.1.1.1/32 OSPF 10 48 D 10.1.1.1 Serial1/0/0
33.1.1.1/32 OSPF 10 1 D 10.1.35.3 GigabitEthernet0/0/0
44.1.1.1/32 OSPF 10 96 D 10.1.1.1 Serial1/0/0
66.1.1.1/32 OSPF 10 48 D 10.1.56.6 Serial2/0/0
[R5-Serial1/0/0]ping 44.1.1.1 //数据完成通信
PING 44.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 44.1.1.1: bytes=56 Sequence=1 ttl=254 time=50 ms
Reply from 44.1.1.1: bytes=56 Sequence=2 ttl=254 time=30 ms
Reply from 44.1.1.1: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 44.1.1.1: bytes=56 Sequence=4 ttl=254 time=10 ms
Reply from 44.1.1.1: bytes=56 Sequence=5 ttl=254 time=30 ms
1.3.2 需要注意的是:
-
开销COST,100M/BW取整,累计开销:所有发送数据出去的接口的总和 ,环回接口华为设备不加,思科设备加
-
P2MP的网络类型每个设备会多出一个标识,即每个设备的物理接口的 /32 的主机路由出现在OSPF路由表中(可能是inactive的路由,HUB上看到分支的32位直连路由是ospf的inactive,分支上看到对端分支的 /32 直连路由是ospf的active)
<R6>tracert -a 66.1.1.1 44.1.1.1
traceroute to 44.1.1.1(44.1.1.1), max hops: 30 ,packet length: 40,press CTRL_C to break
1 10.1.56.5 40 ms 10 ms 10 ms
2 10.1.1.1 20 ms 20 ms 30 ms
3 10.1.1.4 30 ms 30 ms 30 ms
<R6>tracert -a 66.1.1.1 10.10.10.10
traceroute to 10.10.10.10(10.10.10.10), max hops: 30 ,packet length: 40,press CTRL_C to break
1 10.1.56.5 30 ms 10 ms 10 ms
2 10.1.1.1 20 ms 20 ms 20 ms
3 10.1.1.4 30 ms 30 ms 30 ms
4 10.1.34.3 30 ms 30 ms 20 ms
5 10.1.30.10 40 ms 30 ms 40 ms
[R4-Serial1/0/0]dis fr map
Map Statistics for interface Serial1/0/0 (DTE)
DLCI = 401, IP INARP 10.1.1.1, Serial1/0/0
create time = 2018/06/07 15:11:25, status = ACTIVE
encapsulation = ietf, vlink = 1, broadcast
1.3.3 额外的一点东西
[SW1]int lo0
[SW1-LoopBack0]ip address 10.10.10.10 16
<R6>dis ip routing-table protocol ospf //更新到其他设备显示为主机路由
10.10.10.10/32 OSPF 10 193 D 10.1.56.5 Serial2/0/0
[SW1-LoopBack0]ospf network-type broadcast
<R6>dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
Public routing table : OSPF
Destinations : 11 Routes : 11
OSPF routing table status : <Active>
Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.1.1.1/32 OSPF 10 96 D 10.1.56.5 Serial2/0/0
10.1.1.4/32 OSPF 10 144 D 10.1.56.5 Serial2/0/0
10.1.1.5/32 OSPF 10 48 D 10.1.56.5 Serial2/0/0
10.1.30.0/24 OSPF 10 193 D 10.1.56.5 Serial2/0/0
10.1.34.0/24 OSPF 10 192 D 10.1.56.5 Serial2/0/0
10.1.35.0/24 OSPF 10 49 D 10.1.56.5 Serial2/0/0
10.10.0.0/16 OSPF 10 193 D 10.1.56.5 Serial2/0/0 //成为16位路由
11.1.1.1/32 OSPF 10 96 D 10.1.56.5 Serial2/0/0
33.1.1.1/32 OSPF 10 49 D 10.1.56.5 Serial2/0/0
44.1.1.1/32 OSPF 10 144 D 10.1.56.5 Serial2/0/0
55.1.1.1/32 OSPF 10 48 D 10.1.56.5 Serial2/0/0
环回接口华为不管掩码多少,更新到其他设备显示为 32位 的主机路由,改为 broadcast 才能看到其原来的掩码,思科改为p2p就可以
华为设备环回接口默认p2p, 思科设备默认host
1.4 思考题:
//在区域15上,基于以上配置,请使用最少命令确保SW3的vlan15成为DR
此时优先级一样,RID大的SW3成为 DR
//尽量不要使用优先级为0,如果优先级为0,没有备份,如果DR失效,邻居关系处于2-way
[SW3-Vlanif15]ospf dr-priority 0 //区域15都为0
[R5-GigabitEthernet0/0/2]dis ospf peer bri
OSPF Process 1 with Router ID 5.5.5.5
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Serial1/0/0 0.0.0.1 Full
0.0.0.15 GigabitEthernet0/0/2 0.0.0.1 2-Way
0.0.0.15 GigabitEthernet0/0/2 13.13.13.13 2-Way
0.0.0.35 GigabitEthernet0/0/0 33.1.1.1 Full
0.0.0.56 Serial2/0/0 0.0.0.6 Full
[SW3-Vlanif15]dis ospf peer brief
OSPF Process 1 with Router ID 13.13.13.13
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.15 Vlanif15 0.0.0.1 2-Way
0.0.0.15 Vlanif15 5.5.5.5 2-Way
[R1-GigabitEthernet0/0/1]dis ospf peer bri
OSPF Process 1 with Router ID 0.0.0.1
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Serial1/0/0 0.0.4.4 Full
0.0.0.0 Serial1/0/0 5.5.5.5 Full
0.0.0.15 GigabitEthernet0/0/1 13.13.13.13 2-Way
0.0.0.15 GigabitEthernet0/0/1 5.5.5.5 2-Way
[SW3]dis ip routing-table protocol ospf
学习LSA,切入点:
- 通告者(产生LSA的设备)
- 通告的范围
- 功能和内容
域内路由 1、2类LSA
域间路由 3类LSA
外部路由 4、5类LSA
特殊区域 7类LSA
2. 1类和2类LSA
2.1 1类LSA和链路类型(link type)
通告者(产生LSA的设备):任何一台设备。误区:只有区域0的设备才会产生1类LSA
通告的范围:区域内部
功能和内容:产生拓扑信息和路由信息
-
拓扑信息(链路类型是传输网络/p2p):通过什么形式(多点还是点到点)连接到了邻居
-
路由信息(链路类型是末节网络):即需要计算的路由
<R6>dis ospf lsdb router self-originate //本设备产生的1类LSA
OSPF Process 1 with Router ID 0.0.0.6
Area: 0.0.0.56
Link State Database
Type : Router //1类LSA
Ls id : 0.0.0.6 //RID
Adv rtr : 0.0.0.6 //RID
Ls age : 185
Len : 60
Options : E
seq# : 80000010
chksum : 0xdcf6
Link count: 3
* Link ID: 66.1.1.1 //接口的网络
Data : 255.255.255.255 //网络的掩码
Link Type: StubNet // 末节网络,代表路由信息(66.1.1.1/32 接口IP)
Metric : 0 // 66.1.1.1/32的度量是0
Priority : Medium // SPF算法计算的优先级别为中级!
* Link ID: 5.5.5.5
Data : 10.1.56.6
Link Type: P-2-P //代表的拓扑信息,连接5.5.5.5这个设备的地址是10.1.56.6,开销是48
Metric : 48
* Link ID: 10.1.56.0
Data : 255.255.255.0
Link Type: StubNet
Metric : 48 // 10.1.56.0/24这条路由的开销为48
Priority : Low //SPF算法计算的优先级别为低级!
<SW3>dis ospf lsdb router self-originate
OSPF Process 1 with Router ID 13.13.13.13
Area: 0.0.0.15
Link State Database
Type : Router
Ls id : 13.13.13.13
Adv rtr : 13.13.13.13
Ls age : 442
Len : 48
Options : E
seq# : 8000001a
chksum : 0xb59d
Link count: 2
* Link ID: 10.1.15.3 //DR的地址
Data : 10.1.15.3 //自己的地址
Link Type: TransNet //代表的一个多点接入网络,网络中的 DR 的10.1.15.3,没有掩码信息和网络,这个掩码信息从哪里获得呢?这个多点接入网络链接什么设备呢?暂时都不知道
Metric : 1
* Link ID: 13.13.13.13
Data : 255.255.255.255
Link Type: StubNet
Metric : 0
Priority : Medium
//链路类型不能完全等同于网络类型,只能说有关联性。
Point-to-Point:描述一个从本路由器到邻居路由器之间的点到点连接,属于拓扑信息
TransNet:描述一个从本路由器到一个Transit网段(例如NBMA网段或者MA网段)的;连接,属于拓扑信息
SubNet:描述一个从本路由器到一个Stub网段(例如Loopback接口) 的连接,属于路由信息
2.2 华为设备网络类型不一致导致的问题
- 同一区域内所有设备的LSA需要相同
-
广播+点到点 邻居OK,但是由于拓扑信息不一致导致LSA不同步,无法计算路由
-
**广播+点到点 ** 修改hello时间一致,邻居OK,但是由于拓扑信息不一致导致LSA不同步,无法计算路由
-
NBMA+点到点 无法建立邻居,华为设备上NBMA只能和NBMA建立邻居
-
点到点+点到多点 修改时间一致,邻居OK,同时都不需要DR,LSA和拓扑一致,可以计算路由
2.3 2类LSA
- 1类中的传输网络信息不完整,需要借助2类LSA的信息
通告者(产生LSA的设备):DR设备
通告的范围:区域内部
功能和内容:表明DR所在网络链接了哪些设备以及这个接口所在的网络和掩码信息(而且要求掩码一致)
<SW3>dis ospf lsdb network self-originate
OSPF Process 1 with Router ID 13.13.13.13
Area: 0.0.0.15
Link State Database
Type : Network
Ls id : 10.1.15.3 //DR地址
Adv rtr : 13.13.13.13 //DR设备的RID
Ls age : 930
Len : 36
Options : E
seq# : 80000012
chksum : 0xa208
Net mask : 255.255.255.0 //掩码,要求这个多点接入网络统一掩码
Priority : Low
Attached Router 13.13.13.13 //这个多点接入网络链接了SW3、R1和R5
Attached Router 0.0.0.1
Attached Router 5.5.5.5
2.4 SPF算法
两大步骤:
1.构建SPF树
通过 1类 和 2类 LSA拓扑信息搭建骨骼
2.计算最优路由
再通过基于 1类 和 2类 LSA的路由信息计算路由
作业:
修改区域0的网络,使得全网通信,请配置区域15,使用最少命令使得SW3成为DR!
以上是关于5. 12类LSA和SPF计算路由的主要内容,如果未能解决你的问题,请参考以下文章