CCNP之OSPF在NBMA中的五種運行方式

? ? 這篇文檔主要是針對OSPF在NBMA網(wǎng)絡(luò)中運行的五種模式,由于這五種模式一直是比較難理解的部分,文檔會結(jié)合實驗拓?fù)鋱D以及對實驗配置結(jié)果的分析對五種模式進行詳細(xì)闡述。仔細(xì)閱讀并按照我的操作步驟進行實驗配置,絕對會讓你醍醐灌頂。最后還是歡迎各位大牛提出寶貴意見。

1. OSPF在網(wǎng)絡(luò)中運行模式產(chǎn)生的原因

? ? ? 由于在本文中,只介紹NBMA網(wǎng)絡(luò)中的FR網(wǎng)絡(luò),所以以下的NBMA網(wǎng)絡(luò)將由FR網(wǎng)絡(luò)代替。

? ? ? ? FR網(wǎng)絡(luò)沒有廣播功能,而OSPF利用組播傳送LSA報文,在FR網(wǎng)絡(luò)中為了實現(xiàn)廣播或者多播功能,路由器復(fù)制要廣播或者多播的分組,并通過永久虛電路(PVC)發(fā)到所有目的地。該過程需要占用大量的CPU和帶寬。并且,如果FR網(wǎng)絡(luò)不是全網(wǎng)互聯(lián),例如我們常見的hub-spoken拓?fù)涞腇R網(wǎng)絡(luò),那么路由發(fā)送的信息就不會到達所有的目的路由器,也就無法保證OSPF的正常運行。

? ? ? ? 為了解決上述問題,RFC定義了OSPF在NBMA網(wǎng)絡(luò)中的兩種運行模式,Cisco在此基礎(chǔ)上增加了三種運行模式,共五種運行模式。通過定義這五種運行模式,克服了OSPF在幀中繼網(wǎng)絡(luò)中運行存在的問題。

2. OSPF在幀中繼網(wǎng)絡(luò)運行的五種模式

五種運行模式分別為:

non-broadcast,point-to-multipoint,point-to-multipoint

non-broadcast,P2P,Broadcast。

其中前兩種是RFC定義的,Cisco支持以上五種。

要修改OSPF的運行模式,可以使用命令:


在本實驗中需要提前掌握的知識點為:

(1)幀中繼網(wǎng)絡(luò)的基本配置

(2)幀中繼網(wǎng)絡(luò)中動態(tài)映射和靜態(tài)配置的區(qū)別

(3)幀中繼網(wǎng)絡(luò)中全互連和hub-spoken結(jié)構(gòu)的區(qū)別

(4)OSPF的基本配置

3:五種運行模式的區(qū)別

模式一:non-broadcast模式

? ? ?此種模式為OSPF在幀中繼網(wǎng)絡(luò)中默認(rèn)的運行模式,在此模式下,OSPF模仿在廣播網(wǎng)絡(luò)上的運行模式。如果是一個全互連(Full-Mesh)的幀中繼網(wǎng)絡(luò),不需要指定鄰居;如果是一個非全互連(Partial-Mesh)的幀中繼網(wǎng)絡(luò),則需要手動指定鄰居。當(dāng)網(wǎng)絡(luò)中鄰居不多時,non-broadcast是在NBMA網(wǎng)絡(luò)中運行OSPF效率最高的方式。

在本試驗中,采用的是hub-spoken結(jié)構(gòu),屬于非全互連,所以需要手動指定鄰居


模式二:broadcast模式

? ? 當(dāng)運行OSPF的接口設(shè)置為broadcast模式后,此時NBMA網(wǎng)絡(luò)完全看作是一個廣播型鏈路,類似于以太網(wǎng)。此種選舉模式中,需要選舉DR和BDR。

請注意:在本模式下,有兩條關(guān)鍵命令:

第一條:

frame-relaymap ip ip-address??DLCI號? broadcast

關(guān)鍵字broadcast選項表明可以在這條VC上傳播broadcast,multicast幀,所以O(shè)SPF的組播報文就可以正常傳輸,保證了路由協(xié)議的正常運行。

第二條:

ip ospf?priority

由于OSPF的hello報文的TTL值為1,只能傳輸1跳。在Hub&Spoken模式下,為了解決OSPF運行混亂問題,需要通過手動配置方式,將DR固定在Hub端。解決方式是將處于Hub的路由器的接口的優(yōu)先級大于0,其余Spoken端的路由器的接口均為0。

模式三:點到多點(Point-to-multipoint)

? ? 在此模式中,將所有路由器與路由器之間的連接看作是多個點到點鏈路的集合。無需手動指定鄰居,也無需手動指定DR和BDR。

模式四:點到多點非廣播(Point-to-multipoint? non-broadcast)

? ? ?此種模式下,需要手動指定鄰居。

模式五:點到點(point to point)

? ? 此模式運用于點到點子接口。將路由器之間的互聯(lián)看作是多條點與點鏈路的集合。與point-to-multipoint的區(qū)別在于,point-to-point將Hub端的接口劃分為多個邏輯子接口,點與點子接口之間的連接看作是專用VC。每條VC采用組播224.0.0.5發(fā)送協(xié)議報文,無需選舉DR和BDR。

請注意:point-to-point和point-to-multipoint的雖然都可以看作是多個點到點鏈路的集合,但是他們的的區(qū)別在于:hello間隔和死亡時間間隔不一樣。



四:實驗拓?fù)鋱D


五:實驗配置及結(jié)果分析

首先對四臺路由器做基本的配置:

基本的配置如下:

R0(config)#hostname FRS

FRS(config)#frame-relay switching

FRS(config)#int s0/1

FRS(config-if)#clock rate 64000

FRS(config-if)#encapsulation frame-relay

FRS(config-if)#frame-relay lmi-type cisco

FRS(config-if)#frame-relay intf-type dce

FRS(config-if)#frame-relay route 102 int?s0/2 201

FRS(config-if)#frame-relay route 103 int?s0/3 301

FRS(config-if)#no shutdown

FRS(config-if)#int s0/2

FRS(config-if)#no shu

FRS(config-if)#clock rate 64000

FRS(config-if)#encapsulation frame-relay

FRS(config-if)#frame-relay lmi-type cisco

FRS(config-if)#frame-relay intf-type dce

FRS(config-if)#frame-relay route 201 int?s0/1 102

FRS(config)#int s0/3

FRS(config-if)#encapsulation frame-relay

FRS(config-if)#clock rate 64000

FRS(config-if)#frame-relay lmi-type cisco

FRS(config-if)#frame-relay intf-type dce

FRS(config-if)#frame-relay route 301 int?s0/1 103

以上為FRS(幀中繼交換機)的基本配置,在這里請一定注意,本實驗采用的是hub-spoken結(jié)構(gòu),所以在路由器R2和R3之間,并沒有進行接口的映射配置。

FRS(config-if)#do show frame-relay rou////查看接口輸入和輸出對應(yīng)的DLCI

? ? ?第一條命令的含義是:路由器從接口s0/1接口到DLCI=102的數(shù)據(jù)幀,需要從s0/2接口輸出,并且將DLCI替換為201.其余命令的含義類似。

對路由器R1和R2和R3進行基本的配置

R1(config)#int lo 0

R1(config-if)#ip add 1.1.1.1 255.255.255.0

R1(config)#int s0/1

R1(config-if)#no shu

R1(config-if)#no shutdown

R1(config-if)#ip add 192.168.123.1?255.255.255.0

R1(config-if)#encapsulation frame-relay

R1(config-if)#frame-relay lmi-type cisco

R1(config-if)#frame-relay map ip ?192.168.123.2 102 broadcast//采用靜態(tài)映射方式

R1(config-if)#frame-relay map ip?192.168.123.3 103 broadcast

R1(config-if)#frame-relay map ip ?192.168.123.1 102////配置自己接口的IP地址的映射

R1(config-if)#no frame-relay inverse-arp//關(guān)閉IARP

R1(config)#router ospf 1///OSPF的配置

R1(config-router)#network 1.1.1.0 0.0.0.255?area 0///網(wǎng)段的宣告

R1(config-router)#network 192.168.123.0 ?0.0.0.255 area 0

同理R2和R3的配置類似,但是由于R1是HUB點,R2和R3是Spoken點,那么配置有存在不一樣

R2(config)#int lo 0

R2(config-if)#ip add 2.2.2.2 255.255.255.0

R2(config-if)#no shu

R2(config)#int s0/2

R2(config-if)#no shu

R2(config-if)#ip add 192.168.123.2?255.255.255.0

R2(config-if)#encapsulation frame-relay

R2(config-if)#frame-relay lmi-type cisco

R2(config-if)#frame-relay map ip?192.168.123.1 201 broadcast///關(guān)鍵點201

R2(config-if)#frame-relay map ip?192.168.123.3 201 br////關(guān)鍵點201

R2(config-if)#frame-relay map ip?192.168.123.2 201

R2(config-if)#no frame-relay inverse-arp

R2(config)#router ospf 1

R2(config-router)#network 2.2.2.0 0.0.0.255?area 0

R2(config-router)#network 192.168.123.0?0.0.0.255 area 0

R3的基本配置:

R3(config)#int lo 0

R3(config-if)#ip add 3.3.3.3 255.255.255.0

R3(config-if)#no shu

R3(config-if)#exit

R3(config)#int s0/3

R3(config-if)#no shu

R3(config-if)#no shutdown

R3(config-if)#ip add 192.168.123.3?255.255.255.0

R3(config-if)#encapsulation frame-relay

R3(config-if)#frame-relay lmi-type cisco

R3(config-if)#frame-relay map ip?192.168.123.1 301 b///關(guān)鍵點301

R3(config-if)#frame-relay map ip?192.168.123.2 301 br///關(guān)鍵點301

R3(config-if)#no frame-relay inverse-arp

R3(config)#router ospf 1

R3(config-router)#network 3.3.3.0 0.0.0.255?area 0

R3(config-router)#network 192.168.123.0?0.0.0.255 area 0

以上是基本配置,配置完成之后,

R1#show frame-relay map

由此表明靜態(tài)映射配置成功

查看路由表生成狀態(tài):

R1#show ip route ospf

R1#

發(fā)現(xiàn)路由表沒有生成。

R1#show ip os neighbor

表明鄰居沒有生成。

下面針對不同的運行模式找出出現(xiàn)上述問題的原因。

模式一:non-broadcast(缺省模式)

上述實驗中,采用的是幀中繼網(wǎng)絡(luò),默認(rèn)的OSPF網(wǎng)絡(luò)類型為NBMA

在NBMA中,不能發(fā)送廣播或者組播報文,所以路由器的接口之間無法發(fā)送LSA,也就無法建立鄰居。解決方案是手動指定鄰居。

在上述基本配置的基礎(chǔ)上,在R1上需要添加的命令為:

R1(config)#router ospf1

R1(config-router)#neighbor 192.168.123.2

R1(config-router)#nei 192.168.123.3

R1(config-router)#int s0/1

R1(config-if)#ip os priority 10

在R2上添加的命令:

R2(config)#int s0/2

R2(config-if)#ip os priority 0

在R3上添加的命令:

R3(config)#int s0/3

R3(config-if)# ip os pri 0

對上述命令的解釋:

手動指定鄰居(只需要指定一端就可以)之后,鄰居可以建立起來。

R1(config-if)#do show ip os nei

鄰居關(guān)系建立成功,但是請注意:

這里存在修改R1和R2和R3的優(yōu)先級。

? ?由于位于spoken位置的R2和R3只和位于hub端的R1通信。由于hello包的TTL為1,那么路由器R1不會轉(zhuǎn)發(fā)hello包,這樣導(dǎo)致R2和R3無法交流hello包。由于R2和R3的路由器id均比R1大,那么他們就會認(rèn)為自己是DR,而R1只會認(rèn)為R3是DR,因為R3的路由器id最大。這樣就會導(dǎo)致OSPF運行混亂。為了解決這個問題,將R1的優(yōu)先級改為最大,R2和R3的優(yōu)先級均修改為0.不參與DR和BDR的選舉。請注意:R2和R3不可以參與BDR的選舉,原理同上。

查看路由表:

R2#show ip route ospf

R2與R3之間的下一跳均是自己的非直連鄰居。也就是他們之間互訪的時候,忽略了R1的中轉(zhuǎn)。

模式二:Broadcast

首先將在NBMA模式中指定鄰居的命令刪除:

R1(config)#router?ospf 1

R1(config-router)#no?neighbor 192.168.123.2

R1(config-router)#no?neighbor 192.168.123.3

修改網(wǎng)絡(luò)類型:

在R1,R2,R3上均做如下配置:

R1(config-if)#ipospf network br

查看路由表:

R2(config-if)#do show ip rou os

查看R1的鄰居表

R1#show ip os nei

由實驗可以看出,無需手動指定鄰居,在這個過程中有DR的選舉。

重點注意:由于在R1,R2,R3的基本配置命令中,存在關(guān)鍵字broadcast,例如:

R2(config-if)#frame-relay map ip192.168.123.1 201?broadcast

這里broadcast選項表明可以在這條VC上傳播broadcast,multicast幀,所以O(shè)SPF的組播報文就可以正常傳輸,保證了路由協(xié)議的正常運行。

模式三:Point-to-multipoint

在上述配置的基礎(chǔ)上,對R1,R2,R3上均如下配置:

R1/R2/R3(config-if)#ip ospf network?point-to-multipoint

查看鄰居關(guān)系

R1(config-if)#do show ip os nei

由此可以看出,在此種網(wǎng)絡(luò)類型中,無需指定鄰居。也不進行DR和BDR的選舉。

模式四:point-to-multipoint NBMA

在上述配置的基礎(chǔ)上作如下修改:

R1(config-router)#int s0/1

R1(config-if)#ip ospf network point-to-multipoint non-broadcast///修改模式

R1(config-router)#neighbor 192.168.123.2////指定鄰居

R1(config-router)#neighbor 192.168.123.3

分別在R2和R3上做如下修改:

R2(config-if)#int s0/2

R2(config-if)#ip ospf network point-to-multipoint non-broadcast

R3(config-if)#int s0/3

R3(config-if)#ip ospf network point-to-multipoint non-broadcast

查看鄰居建立關(guān)系:

查看路由表:

路由表成功生成。

模式五:point to point

首先是對位于hub端的R1進行配置

R1(config)#int s0/1

R1(config-if)#no ip add 192.168.123.1 255.255.255.0

R1(config-if)# no frame-relay map ip?192.168.123.2 102 bro////

R1(config-if)#no frame-relay map ip?192.168.123.3 103 bro

R1(config-if)#no frame-relay map ip?192.168.123.1 102 bro

////上述三條命令是將原來主接口下面的靜態(tài)映射刪除

////下面命令是設(shè)定子接口,并對子接口進行靜態(tài)映射

R1(config)#int s0/1.2 po

R1(config)#int s0/1.2 point-to-point

R1(config-subif)#frame-relay interface-dlci?102

R1(config-subif)#ip address 192.168.12.1?255.255.255.0

R1(config-subif)#frame-relay interface-dlci?102

R1(config-fr-dlci)#exit

R1(config-subif)#exit

R1(config)#int s0/1.3 point-to-point

R1(config-subif)#ip add 192.168.13.1?255.255.255.0

R1(config-subif)#frame-relay interface-dlci?103

///下面命令是把子接口的網(wǎng)段宣告進OSPF進程

R1(config)#router ospf 1

R1(config-router)#network 192.168.12.0?0.0.0.255 area 0

R1(config-router)#network 192.168.13.0?0.0.0.255 area 0

下面對位于spoken端的R2和R3進行配置

R2(config)#int s0/2

///首先把主接口下原來的靜態(tài)映射刪除

R2(config-if)#no frame-relay map ip?192.168.123.1 201 br

R2(config-if)#no frame-relay map ip?192.168.123.3 201 br

R2(config-if)#no ip add

////修改主接口的網(wǎng)絡(luò)類型

R2(config-if)#ip ospf network?point-to-point

////保證主接口的ip地址與R1上對應(yīng)的子接口的ip地址在同一個網(wǎng)段

R2(config-if)#ip add 192.168.12.2?255.255.255.0

R2(config-if)#EXIT

R2(config)#router ospf 1

R2(config-router)#network 192.168.12.0 ?0.0.0.255 area 0

R2(config-router)# no network 192.168.123.2?0.0.0.255 area 0

R3的配置為:

R3(config)#int s0/3

///首先把主接口下原來的靜態(tài)映射刪除

R3(config-if)#no frame-relay map ip?192.168.123.1 301 br

R3(config-if)#no frame-relay map ip?192.168.123.2 301 br

R3(config-if)#no ip add

////修改主接口的網(wǎng)絡(luò)類型

R3(config-if)#ip ospf network?point-to-point

////保證主接口的ip地址與R1上對應(yīng)的子接口的ip地址在同一個網(wǎng)段

R3(config-if)#ip add 192.168.13.3?255.255.255.0

R3(config-if)#EXIT

R3(config)#router os

R3(config)#router ospf 1

R3(config-router)#network 192.168.13.0?0.0.0.255 area 0

R3(config-router)#no network 192.168.123.0?0.0.0.255 area 0

做完上述配置之后,查看鄰居建立:

R1#show ip os neighbor

由此看出,此時鄰居并沒有建立成功

重點注意:

? ? ?之所以鄰居關(guān)系沒有建立成功,是由于把R1上的主接口ip地址去掉了,取而代之的是使用R1的子接口,所以在做靜態(tài)映射到時候,需要對應(yīng)的子接口的映射。

所以,我們需要做的就是在R2和R3的接口下作與子接口的靜態(tài)映射

在R2上添加如下命令:

R2(config-if)#ints0/2

R2(config-if)#frame-relay map ip 192.168.12.1 201 broadcast

在R3上添加如下命令:

R3(config)#int s0/3

R3(config-if)#frame-relay map ip?192.168.13.1 301 broadcast

查看鄰居關(guān)系:

R1#show ip os nei

鄰居建立成功,但是不選舉DR和BDR。

六:總結(jié)

? ? ? ?通過對實驗的配置分析,得出如下結(jié)論:

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容