OSPF的DR和BDR
原理概述
原因
在OSPF的廣播和NBMA類型網(wǎng)絡(luò)中,如果有臺(tái)路由器,若任意兩臺(tái)路由器之間都要建立鄰接關(guān)系,則需要建立n*(n-1)/2個(gè)鄰接關(guān)系,即當(dāng)路由器很多時(shí),則需要建立和維護(hù)的鄰接關(guān)系就很多,兩兩之間需要發(fā)送的報(bào)文也就很多,這會(huì)造成內(nèi)容重復(fù)的報(bào)文在網(wǎng)絡(luò)中傳遞,浪費(fèi)了設(shè)備的帶寬資源。
定義:
DR(Designated Router,指定路由器),即所有其他路由器都只將各自的鏈路狀態(tài)信息發(fā)送給DR,再由DR以組播方式發(fā)送至所有路由器。
BDR(Backup Designated Router)的概念,作為DR路由器的備份,當(dāng)DR路由器失效時(shí),BDR成為DR,并再選擇新的BDR路由器。其他非DR/BDR路由器都稱為DR Other 路由器。
選舉DR/BDR的規(guī)則:
- DR優(yōu)先級(jí),如果DR優(yōu)先級(jí)為0,則不參與選舉
- Router-ID
需要注意的是,DR是在某個(gè)廣播或者NBMA網(wǎng)段內(nèi)進(jìn)行選舉的,是針對(duì)路由器的接口而言的。某個(gè)路由器在一個(gè)接口上可能是DR,在另一個(gè)接口上可能是BDR,或者是DR Other。
實(shí)驗(yàn)內(nèi)容
實(shí)驗(yàn)拓?fù)?/h2>
實(shí)驗(yàn)步驟
1.配置路由器接口地址和環(huán)回接口地址
2.配置ospf網(wǎng)絡(luò)
配置完成后,同時(shí)重啟4臺(tái)路由器上的OSPF進(jìn)程,或者直接同時(shí)重啟路由器。
<R1>reset ospf process <R2>reset ospf process <R3>reset ospf process <R4>reset ospf process使用display ospf peer brief查看OSPF鄰居建立情況
[R1]dis ospf peer brief OSPF Process 1 with Router ID 1.1.1.1Peer Statistic Information----------------------------------------------------------------------------Area Id Interface Neighbor id State 0.0.0.0 GigabitEthernet0/0/0 2.2.2.2 2-Way 0.0.0.0 GigabitEthernet0/0/0 3.3.3.3 Full 0.0.0.0 GigabitEthernet0/0/0 4.4.4.4 Full ----------------------------------------------------------------------------可以觀察到,R1已經(jīng)和其他路由器成功建立起OSPF鄰居關(guān)系。查看DR/BDR狀態(tài)
[R1]dis ospf peer OSPF Process 1 with Router ID 1.1.1.1Neighbors Area 0.0.0.0 interface 172.16.1.1(GigabitEthernet0/0/0)'s neighborsRouter ID: 2.2.2.2 Address: 172.16.1.2 State: 2-Way Mode:Nbr is Master Priority: 1DR: 172.16.1.4 BDR: 172.16.1.3 MTU: 0 Dead timer due in 31 sec Retrans timer interval: 0 Neighbor is up for 00:00:00 Authentication Sequence: [ 0 ] Router ID: 3.3.3.3 Address: 172.16.1.3 State: Full Mode:Nbr is Master Priority: 1DR: 172.16.1.4 BDR: 172.16.1.3 MTU: 0 Dead timer due in 35 sec Retrans timer interval: 5 Neighbor is up for 00:05:13 Authentication Sequence: [ 0 ] Router ID: 4.4.4.4 Address: 172.16.1.4 State: Full Mode:Nbr is Master Priority: 1DR: 172.16.1.4 BDR: 172.16.1.3 MTU: 0 Dead timer due in 36 sec Retrans timer interval: 0 Neighbor is up for 00:05:13 Authentication Sequence: [ 0 ] 可以觀察到,R4為DR,R3為BDR。這是由于在默認(rèn)情況下,每臺(tái)路由器上的DR優(yōu)先級(jí)都為1,此時(shí)是通過Router-ID的數(shù)值高低比較的。3.驗(yàn)證網(wǎng)絡(luò)類型點(diǎn)到多點(diǎn)的選舉情況
[R1]int g0/0/0 [R1-GigabitEthernet0/0/0]ospf network-type p2mp[R2]int g0/0/0 [R2-GigabitEthernet0/0/0]ospf network-type p2mp[R3]int g0/0/0 [R3-GigabitEthernet0/0/0]ospf network-type p2mp[R4]int g0/0/0 [R4-GigabitEthernet0/0/0]ospf network-type p2mp在R1上再次觀察此時(shí)OSPF的選舉情況
[R1]dis ospf peer OSPF Process 1 with Router ID 1.1.1.1Neighbors Area 0.0.0.0 interface 172.16.1.1(GigabitEthernet0/0/0)'s neighborsRouter ID: 2.2.2.2 Address: 172.16.1.2 State: Full Mode:Nbr is Master Priority: 1DR: None BDR: None MTU: 0 Dead timer due in 112 sec Retrans timer interval: 5 Neighbor is up for 00:01:50 Authentication Sequence: [ 0 ] Router ID: 3.3.3.3 Address: 172.16.1.3 State: Full Mode:Nbr is Master Priority: 1DR: None BDR: None MTU: 0 Dead timer due in 101 sec Retrans timer interval: 5 Neighbor is up for 00:00:47 Authentication Sequence: [ 0 ] Router ID: 4.4.4.4 Address: 172.16.1.4 State: Full Mode:Nbr is Master Priority: 1DR: None BDR: None MTU: 0 Dead timer due in 103 sec Retrans timer interval: 0 Neighbor is up for 00:00:47 Authentication Sequence: [ 0 ] 可以觀察到,DR/BDR都為None,驗(yàn)證了在點(diǎn)到多點(diǎn)的網(wǎng)絡(luò)類型中不選舉DR/BDR。在點(diǎn)到點(diǎn)的網(wǎng)絡(luò)中也是。4.根據(jù)網(wǎng)絡(luò)需求影響DR/BDR選舉
根據(jù)需求,需要使性能較好、處理能力較強(qiáng)的R1成為DR,性能次之的R2成為BDR,而性能最差的R4不能參加選舉。
首先將OSPF網(wǎng)絡(luò)類型還原為默認(rèn)的廣播網(wǎng)絡(luò)類型
[R1]int g0/0/0 [R1-GigabitEthernet0/0/0]ospf network-type broadcast[R2]int g0/0/0 [R2-GigabitEthernet0/0/0]ospf network-type broadcast[R3]int g0/0/0 [R3-GigabitEthernet0/0/0]ospf network-type broadcast[R4]int g0/0/0 [R4-GigabitEthernet0/0/0]ospf network-type broadcast配置完成后,修改R1上的接口的DR優(yōu)先級(jí)為100,R2為50,R4為0,R3保持默認(rèn)不變
[R1]int g0/0/0 [R1-GigabitEthernet0/0/0]ospf dr-priority 100[R2]int g0/0/0 [R2-GigabitEthernet0/0/0]ospf dr-priority 50[R4]int g0/0/0 [R4-GigabitEthernet0/0/0]ospf dr-priority 0配置完成后,查看路由器的DR/BDR選舉情況
[R1]dis ospf peer OSPF Process 1 with Router ID 1.1.1.1Neighbors Area 0.0.0.0 interface 172.16.1.1(GigabitEthernet0/0/0)'s neighborsRouter ID: 2.2.2.2 Address: 172.16.1.2 State: Full Mode:Nbr is Master Priority: 50DR: 172.16.1.3 BDR: 172.16.1.1 MTU: 0 Dead timer due in 34 sec Retrans timer interval: 5 Neighbor is up for 00:01:08 Authentication Sequence: [ 0 ] Router ID: 3.3.3.3 Address: 172.16.1.3 State: Full Mode:Nbr is Master Priority: 1DR: 172.16.1.3 BDR: 172.16.1.1 MTU: 0 Dead timer due in 34 sec Retrans timer interval: 0 Neighbor is up for 00:03:11 Authentication Sequence: [ 0 ] Router ID: 4.4.4.4 Address: 172.16.1.4 State: Full Mode:Nbr is Master Priority: 0DR: 172.16.1.3 BDR: 172.16.1.1 MTU: 0 Dead timer due in 29 sec Retrans timer interval: 5 Neighbor is up for 00:01:03 Authentication Sequence: [ 0 ] 發(fā)現(xiàn)此時(shí)的DR與BDR都沒有改變,即驗(yàn)證了OSPF的選舉是非搶占性的。同時(shí)重啟4臺(tái)路由器的OSPF進(jìn)程,或者直接同時(shí)重啟路由器。
[R1]dis ospf peerOSPF Process 1 with Router ID 1.1.1.1Neighbors Area 0.0.0.0 interface 172.16.1.1(GigabitEthernet0/0/0)'s neighborsRouter ID: 2.2.2.2 Address: 172.16.1.2 State: Full Mode:Nbr is Master Priority: 50DR: 172.16.1.1 BDR: 172.16.1.2 MTU: 0 Dead timer due in 31 sec Retrans timer interval: 4 Neighbor is up for 00:00:23 Authentication Sequence: [ 0 ] Router ID: 3.3.3.3 Address: 172.16.1.3 State: Full Mode:Nbr is Master Priority: 1DR: 172.16.1.1 BDR: 172.16.1.2 MTU: 0 Dead timer due in 33 sec Retrans timer interval: 5 Neighbor is up for 00:00:23 Authentication Sequence: [ 0 ] Router ID: 4.4.4.4 Address: 172.16.1.4 State: Full Mode:Nbr is Master Priority: 0DR: 172.16.1.1 BDR: 172.16.1.2 MTU: 0 Dead timer due in 33 sec Retrans timer interval: 5 Neighbor is up for 00:00:13 Authentication Sequence: [ 0 ] 此時(shí)在該廣播網(wǎng)絡(luò)中,R1為DR,R2為BDR。實(shí)驗(yàn)?zāi)康?/h2>
- 理解OSPF在哪種網(wǎng)絡(luò)類型中會(huì)選舉DR/BDR
- 掌握OSPF DR/BDR的選舉規(guī)則
- 掌握如何更改設(shè)備接口上的DR優(yōu)先級(jí)
- 理解OSPF DR/BDR選舉的非搶占性特性
總結(jié)
以上是生活随笔為你收集整理的OSPF的DR和BDR的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 软件开发V模型--解读
- 下一篇: 阜阳的热带鱼水族店有哪些(照片)