News
发布日期:2023-04-28 浏览次数:1865 来源:崔志鹏
HCIE培训理论技术学习LSDB(链路状态数据库)的同步-WOLFLAB
WOLFLAB官方微信:17316362402,HCIE培训理论技术学习可联系WOLFLAB网络技术实验室,了解HCIE培训价格多少钱,HCIE培训考试费用多少钱,HCIE培训开班情况等!
HCIE培训中 IS-IS的LSP交互过程
LSP产生的原因
IS-IS路由域内的所有路由器都会产生LSP,以下事件会触发一个新的LSP:
• 邻居Up或Down
• IS-IS相关接口Up或Down
• 引入的IP路由发生变化
• 区域间的IP路由发生变化
• 接口被赋了新的metric值
• 周期性更新
HCIE培训中 收到邻居新的LSP的处理过程
1. 将接收的新的LSP合入到自己的LSDB数据库中,并标记为flooding。
2. 发送新的LSP到除了收到该LSP的接口之外的接口。
3. 邻居再扩散到其他邻居。
LSP的“泛洪”
LSP报文的“泛洪”(flooding)是指当一个路由器向相邻路由器通告自己的LSP后,相邻路由器再将同样的LSP报文传送到除发送该LSP的路由器外的其它邻居,并这样逐级将LSP传送到整个层次内所有路由器的一种方式。通过这种“泛洪”,整个层次内的每一个路由器就都可以拥有相同的LSP信息,并保持LSDB的同步。
每一个LSP都拥有一个标识自己的4字节的序列号。在路由器启动时所发送的第一个LSP报文中的序列号为1,以后当需要生成新的LSP时,新LSP的序列号在前一个LSP序列号的基础上加1。更高的序列号意味着更新的LSP。
P2P网络LSDB同步过程如下:
为了实现LSDB的同步,两台设备在邻居关系建立起来之后彼此发送CSNP报文,里面携带LSP的头部信息
R1发送的CSNP:
Frame 40: 71 bytes on wire (568 bits), 71 bytes captured (568 bits) on interface -, id 0
Point-to-Point Protocol
ISO 10589 ISIS InTRA Domain Routeing Information Exchange Protocol
ISO 10589 ISIS Complete Sequence Numbers Protocol Data Unit
PDU length: 67
Source-ID: 0000.0000.0001
Source-ID-Circuit: 00
Start LSP-ID: 0000.0000.0000.00-00
End LSP-ID: ffff.ffff.ffff.ff-ff
LSP entries (t=9, l=32)
Type: 9
Length: 32
LSP Entry
LSP Sequence Number: 0x0000000c
Remaining Lifetime: 1191
LSP checksum: 0x4a16
LSP-ID: 0000.0000.0001.00-00
R2发送的CSNP:
Frame 39: 71 bytes on wire (568 bits), 71 bytes captured (568 bits) on interface -, id 0
Point-to-Point Protocol
ISO 10589 ISIS InTRA Domain Routeing Information Exchange Protocol
ISO 10589 ISIS Complete Sequence Numbers Protocol Data Unit
PDU length: 67
Source-ID: 0000.0000.0002
Source-ID-Circuit: 00
Start LSP-ID: 0000.0000.0000.00-00
End LSP-ID: ffff.ffff.ffff.ff-ff
LSP entries (t=9, l=32)
Type: 9
Length: 32
LSP Entry
LSP Sequence Number: 0x0000000e
Remaining Lifetime: 1192
LSP checksum: 0x56fe
LSP-ID: 0000.0000.0002.00-00
同步的规则:交换彼此没有的LSP以及新的LSP替换老旧的LSP,实现LSDB的同步。
为了实现同步,对LSP的数据结构做出定义要能实现如下功能:
如何唯一的区分一条LSP呢?
ISIS协议定义通过LSP ID唯一的区分一条LSP
0000.0000.0001.00-00 //8个字节由三个部分组成
LSP ID=system id(6字节)+伪节点标识符(1字节)+分片标识符(1字节)
system id:表示LSP产生路由器的system id,类似于ADV ROUTER;
伪节点标识符:取值0或者非0,如果等于0,则代表该LSP是实节点LSP。如果是非0,则代表该LSP是伪节点LSP,此时system id就是DIS的system id。
分片标识符:用于描述同一台路由器产生的不同的LSP
为什么分片呢?
假设一台路由器需要描述的链路信息特别的多,用一条LSP装不下,就会通过多条LSP进行携带,并且泛洪给邻居,有点像IP报文的分片。
举例:下图就是一台路由器产生的多个实节点LSP
0000.0000.0001.00-00
0000.0000.0001.00-01
0000.0000.0001.00-02
举例:下图就是一台路由器产生的多个伪节点LSP
R1作为多个二层广播域的DIS
0000.0000.0001.01-00
0000.0000.0001.02-00
LSP的新旧判断机制:
1、比较LSP seq,越大越新。
2、seq相同,则判断remain lifetime是否为0,如果等于0,则认为是最新的LSP,用于删除一条LSP。ISIS的holdtime是倒计时,越来越小,OSPF是越来越大。remain lifetime的初始值是1200s,每隔15min,即900s周期性泛红更新LSP,同时序列号+1。
3、如果remain lifetime都不等于0,则比较checksum,越大越新。
4、如果checksum一样,则认为是相同的LSP。
注意:isis的seq的初始值是从1开始,最大值是全F。
什么叫撤销一条LSP?
假设AR1上写两条静态路由,并将静态路由引入ISIS。
ip route-static 192.168.1.0 255.255.255.0 NULL0
ip route-static 192.168.2.0 255.255.255.0 NULL0
@此时R1就会产生一条LSP,里面携带两条路由;
@R1针对外部路由采用分片的LSP去携带;
@此时R1产生这条分片的LSP seq=1
Frame 817: 57 bytes on wire (456 bits), 57 bytes captured (456 bits) on interface -, id 0
Point-to-Point Protocol
ISO 10589 ISIS InTRA Domain Routeing Information Exchange Protocol
ISO 10589 ISIS Link State Protocol Data Unit
PDU length: 53
Remaining lifetime: 1198
LSP-ID: 0000.0000.0001.00-01
Sequence number: 0x00000001
Checksum: 0x788d [correct]
[Checksum Status: Good]
Type block(0x03): Partition Repair:0, Attached bits:0, Overload bit:0, IS type:3
IP External reachability (t=130, l=24)
Type: 130
Length: 24
IPv4 prefix: 192.168.1.0/24
IPv4 prefix: 192.168.2.0/24
@如果将引入的静态命令拿掉,此时LSP就会重新产生一条LSP,里面不携带路由信息,seq=2,remaining lifetime=0,此时R2就将该LSP从自己的LSP中删除掉。
Frame 994: 31 bytes on wire (248 bits), 31 bytes captured (248 bits) on interface -, id 0
Point-to-Point Protocol
ISO 10589 ISIS InTRA Domain Routeing Information Exchange Protocol
ISO 10589 ISIS Link State Protocol Data Unit
PDU length: 27
Remaining lifetime: 0
LSP-ID: 0000.0000.0001.00-01
Sequence number: 0x00000002
[Checksum: [missing]]
[Checksum Status: Not present]
Type block(0x03): Partition Repair:0, Attached bits:0, Overload bit:0, IS type:3
@如果R1此时再引人静态,又会产生一条LSP,seq=3:
Frame 1085: 57 bytes on wire (456 bits), 57 bytes captured (456 bits) on interface -, id 0
Point-to-Point Protocol
ISO 10589 ISIS InTRA Domain Routeing Information Exchange Protocol
ISO 10589 ISIS Link State Protocol Data Unit
PDU length: 53
Remaining lifetime: 1197
LSP-ID: 0000.0000.0001.00-01
Sequence number: 0x00000003
Checksum: 0x748f [correct]
[Checksum Status: Good]
Type block(0x03): Partition Repair:0, Attached bits:0, Overload bit:0, IS type:3
IP External reachability (t=130, l=24)
Type: 130
Length: 24
IPv4 prefix: 192.168.1.0/24
IPv4 prefix: 192.168.2.0/24
@R1此时仅删除一条192.168.2.0/24的路由,此时R1也会产生一条LSP,seq=4,此时R2收到后就用新的LSP替换旧的了:
Frame 1195: 45 bytes on wire (360 bits), 45 bytes captured (360 bits) on interface -, id 0
Point-to-Point Protocol
ISO 10589 ISIS InTRA Domain Routeing Information Exchange Protocol
ISO 10589 ISIS Link State Protocol Data Unit
PDU length: 41
Remaining lifetime: 1197
LSP-ID: 0000.0000.0001.00-01
Sequence number: 0x00000004
Checksum: 0x1e1e [correct]
[Checksum Status: Good]
Type block(0x03): Partition Repair:0, Attached bits:0, Overload bit:0, IS type:3
IP External reachability (t=130, l=12)
Type: 130
Length: 12
IPv4 prefix: 192.168.1.0/24
课件理想过程:
1、邻居关系建立起来之后,两台设备互相发送CSNP,里面携带本设备LSDB中所有的LSP的头部信息;
2、通过比较邻居发送过来的头部信息,我就知道哪些LSP你有我没有,哪些LSP是我有你没有的;
3、我没有的就给邻居发送PSNP进行请求;
@PSNP报文中携带的就是就是六元组
@PSNP报文中的SEQ+checksum+remain lifetime并没有携带的必要,因为OSPF中的LSR只携带了LSA的三要素;
@PSNP报文中SEQ=0,表明该报文为请求报文,下图为理想情况下R2给R1发送的PSNP请求报文;
Frame 35: 39 bytes on wire (312 bits), 39 bytes captured (312 bits) on interface -, id 0
Point-to-Point Protocol
ISO 10589 ISIS InTRA Domain Routeing Information Exchange Protocol
ISO 10589 ISIS Partial Sequence Numbers Protocol Data Unit
PDU length: 35
Source-ID: 0000.0000.0002
Source-ID-Circuit: 00
LSP entries (t=9, l=16)
Type: 9
Length: 16
LSP Entry
LSP Sequence Number: 0x00000000
Remaining Lifetime: 1194
LSP checksum: 0x4a16
LSP-ID: 0000.0000.0001.00-00
4、R1收到请求报文之后,R2请求的LSP,就是R1的LSP的详细信息;
Frame 32: 88 bytes on wire (704 bits), 88 bytes captured (704 bits) on interface -, id 0
Point-to-Point Protocol
ISO 10589 ISIS InTRA Domain Routeing Information Exchange Protocol
ISO 10589 ISIS Link State Protocol Data Unit
PDU length: 84
Remaining lifetime: 1195
LSP-ID: 0000.0000.0001.00-00
Sequence number: 0x0000000c
Checksum: 0x4a16 [correct]
[Checksum Status: Good]
Type block(0x03): Partition Repair:0, Attached bits:0, Overload bit:0, IS type:3 //这条LSP的相关BIT位
0... .... = Partition Repair: Not supported
.000 0... = Attachment: 0
.... 0... = Error metric: Not set
.... .0.. = Expense metric: Not set
.... ..1. = Delay metric: Set
.... ...1 = Default metric: Set
.... .0.. = Overload bit: Not set
.... ..11 = Type of Intermediate System: Level 2 (3)
Protocols supported (t=129, l=1)
Area address(es) (t=1, l=2)
IS Reachability (t=2, l=12) //描述拓扑信息,R1表明自己P2P的连着02的路由器,因为最后为00,如果是广播型链路R1会说自己连着伪节点,最后肯定不为00
Type: 2
Length: 12
Reserved: 0x00
IS Neighbor: 0000.0000.0002.00
..00 1010 = Default Metric: 10
.0.. .... = Default Metric: Internal
..00 1010 = Delay Metric: 10
0... .... = Delay Metric: Supported
.0.. .... = Delay Metric: Internal
..00 1010 = Expense Metric: 10
0... .... = Expense Metric: Supported
.0.. .... = Expense Metric: Internal
..00 1010 = Error Metric: 10
0... .... = Error Metric: Supported
.0.. .... = Error Metric: Internal
IS Neighbor: 0000.0000.0002.00
IP Interface address(es) (t=132, l=8) //会把自己所有运行isis的接口地址携带出去
Type: 132
Length: 8
IPv4 interface address: 1.1.1.1
IPv4 interface address: 1.1.12.1
IP Internal reachability (t=128, l=24) //携带自己的路由信息
Type: 128
Length: 24
IPv4 prefix: 1.1.1.1/32
..00 0000 = Default Metric: 0
.0.. .... = Default Metric IE: Internal //表示路由的cost类型
0... .... = Distribution: Up //DU bit
..00 0000 = Delay Metric: 0
1... .... = Delay Metric: Not Supported
.0.. .... = Delay Metric: Internal
..00 0000 = Expense Metric: 0
1... .... = Expense Metric: Not Supported
.0.. .... = Expense Metric: Internal
..00 0000 = Error Metric: 0
1... .... = Error Metric: Not Supported
.0.. .... = Error Metric: Internal
IPv4 prefix: 1.1.12.0/24
..00 1010 = Default Metric: 10
.0.. .... = Default Metric IE: Internal
0... .... = Distribution: Up
..00 0000 = Delay Metric: 0
1... .... = Delay Metric: Not Supported
.0.. .... = Delay Metric: Internal
..00 0000 = Expense Metric: 0
1... .... = Expense Metric: Not Supported
.0.. .... = Expense Metric: Internal
..00 0000 = Error Metric: 0
1... .... = Error Metric: Not Supported
.0.. .... = Error Metric: Internal
5、R2收到之后发送一个PSNP进行确认,就是将R1发送过来的LSP中的六元组发在PSNP里面告诉R1我收到你发给我的LSP了
Frame 35: 39 bytes on wire (312 bits), 39 bytes captured (312 bits) on interface -, id 0
Point-to-Point Protocol
ISO 10589 ISIS InTRA Domain Routeing Information Exchange Protocol
ISO 10589 ISIS Partial Sequence Numbers Protocol Data Unit
PDU length: 35
Source-ID: 0000.0000.0002
Source-ID-Circuit: 00
LSP entries (t=9, l=16)
Type: 9
Length: 16
LSP Entry
LSP Sequence Number: 0x0000000c
Remaining Lifetime: 1194
LSP checksum: 0x4a16
LSP-ID: 0000.0000.0001.00-00
6、如果R1长时间没有收到R2的PSNP,我就会每隔5S重传LSP;
7、ISIS每隔900s周期性更新,谁产生的谁负责更新,就是将该LSP的SEQ+1,checksum重新算,remain lifetime置位1200;
8、设备收到新的LSP,替换自己LSDB现有的旧的LSP,并且LSP的老化时间重新置位1200;
实际的过程:
1、邻居关系建立起来之后,两台设备直接互相发送自己所有的LSP;
2、彼此发送PSNP进行确认,表示我收到对端的LSP了;
3、此时LSDB完成同步,两台设备会发送CSNP,里面携带自己LSDB里面所有LSP的头部信息,来验证一下LSDB是否同步;
广播型网络的交互过程
HCIE培训循环开班,联系网站客服预约免费试听
实际过程如下:
1、邻居关系建立起来之后,两台设备直接互相发送自己所有的LSP;
注意:两台设备邻居建立之后非DIS会马上发送LSP,DIS 20s之后发送LSP,因为需要通过hello报文会选举DIS,DIS的选举时间是20s,ospf选举DR的时间是40s;
ISIS是邻居关系建立起来之后才去选举DIS,OSPF是邻居关系建立的时候就去选DR,所以为啥ISIS邻居关系建立的那么快;
2、假设R2被选举为DIS,此时邻居关系建立起来R1会发送一条实节点LSP,R2会发送一条实节点LSP,一条伪节点LSP;
R1发的:
Frame 26: 101 bytes on wire (808 bits), 101 bytes captured (808 bits) on interface -, id 0
IEEE 802.3 Ethernet
Logical-Link Control
ISO 10589 ISIS InTRA Domain Routeing Information Exchange Protocol
ISO 10589 ISIS Link State Protocol Data Unit
PDU length: 84
Remaining lifetime: 1199
LSP-ID: 0000.0000.0001.00-00
Sequence number: 0x00000007
Checksum: 0x6af9 [correct]
[Checksum Status: Good]
Type block(0x03): Partition Repair:0, Attached bits:0, Overload bit:0, IS type:3
Protocols supported (t=129, l=1)
Area address(es) (t=1, l=2)
IS Reachability (t=2, l=12)
IP Interface address(es) (t=132, l=8)
IP Internal reachability (t=128, l=24)
Type: 128
Length: 24
IPv4 prefix: 1.1.1.1/32
IPv4 prefix: 1.1.12.0/24
---------------------------------------------------------------
R2发的:
Frame 29: 72 bytes on wire (576 bits), 72 bytes captured (576 bits) on interface -, id 0
IEEE 802.3 Ethernet
Logical-Link Control
ISO 10589 ISIS InTRA Domain Routeing Information Exchange Protocol
ISO 10589 ISIS Link State Protocol Data Unit
PDU length: 55
Remaining lifetime: 1199
LSP-ID: 0000.0000.0002.01-00
Sequence number: 0x00000002
Checksum: 0xa2e6 [correct]
[Checksum Status: Good]
Type block(0x03): Partition Repair:0, Attached bits:0, Overload bit:0, IS type:3
Protocols supported (t=129, l=1)
IS Reachability (t=2, l=23)
Type: 2
Length: 23
Reserved: 0x00
IS Neighbor: 0000.0000.0002.00
IS Neighbor: 0000.0000.0001.00
Frame 30: 101 bytes on wire (808 bits), 101 bytes captured (808 bits) on interface -, id 0
IEEE 802.3 Ethernet
Logical-Link Control
ISO 10589 ISIS InTRA Domain Routeing Information Exchange Protocol
ISO 10589 ISIS Link State Protocol Data Unit
PDU length: 84
Remaining lifetime: 1199
LSP-ID: 0000.0000.0002.00-00
Sequence number: 0x00000007
Checksum: 0x8fca [correct]
[Checksum Status: Good]
Type block(0x03): Partition Repair:0, Attached bits:0, Overload bit:0, IS type:3
Protocols supported (t=129, l=1)
Area address(es) (t=1, l=2)
IS Reachability (t=2, l=12)
IP Interface address(es) (t=132, l=8)
IP Internal reachability (t=128, l=24)
Type: 128
Length: 24
IPv4 prefix: 2.2.2.2/32
IPv4 prefix: 1.1.12.0/24
3、此时LSDB正式完成同步,两台设备无需发送PSNP确认,因为广播型网络DIS会周期性的每隔发送CSNP,来保证LSDB的同步;
Frame 37: 100 bytes on wire (800 bits), 100 bytes captured (800 bits) on interface -, id 0
IEEE 802.3 Ethernet
Logical-Link Control
ISO 10589 ISIS InTRA Domain Routeing Information Exchange Protocol
ISO 10589 ISIS Complete Sequence Numbers Protocol Data Unit
PDU length: 83
Source-ID: 0000.0000.0002
Source-ID-Circuit: 00
Start LSP-ID: 0000.0000.0000.00-00
End LSP-ID: ffff.ffff.ffff.ff-ff
LSP entries (t=9, l=48)
Type: 9
Length: 48
LSP Entry
LSP-ID: 0000.0000.0001.00-00
LSP Entry
LSP-ID: 0000.0000.0002.00-00
LSP Entry
LSP-ID: 0000.0000.0002.01-00
课件上的情况如下:
前提:新加入的路由器RouterC不会将DIS抢走
@B和C一旦建立邻居就会互相发送自身LSDB中的LSP;
@A和C也会建立邻居,但是不会交互LSDB中的LSP,避免重复发送;
@非DIS路由器接收到新增路由器的LSP后,如果是新的就直接添加到自己的LSP,并且不会发送PSNP确认,并向其他链路上的邻居泛洪这些LSP;
@此时LSDB完成同步,DIS会周期性的每隔10s发送CSNP,携带自己LSDB中的头部信息;
@如果新增路由器收到DIS的CSNP,比较自身的LSDB,发现有的LSP我没有则发送PSNP,DIS接收此PSNP,发送LSP。C收到后添加到自身的LSDB,不会发送PSNP确认这些LSP,同步结束,并向其他链路泛洪;
@DIS每10s周期性发送CSNP,维护广播型网络上路由器的LSDB同步;
@万一我没有收到,就根据DIS周期性发送的CSNP,然后我发送PSNP请求就行;
HCIE培训开班咨询可联系WOLFLAB网络实验室网站客服
我们会陆续更新CCNA|CCNP|EI CCIE;HCIA|HCIP|HCIE Datacom|VMware等学习视频,IT技术,学习技巧等
WOLFLAB官方微信:17316362402
WOLFLAB官方QQ:2569790740