---------------------------------------------------------------
OSPF在NBMA網絡中的解決方案
---------------------------------------------------------------
一、OSPF在NBMA網絡中產生的通信問題
配置基本的幀中繼網絡
幀中繼配置
R1:
interface s1/0
ip address 192.168.1.1 255.255.255.0
no shutdown
encapsulation frame-relay
no frame-relay inverse-arp
frame-relay map ip 192.168.1.2 102 broadcast
frame-relay map ip 192.168.1.3 103 broadcast
exit
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
R2:
interface s1/0
ip address 192.168.1.2 255.255.255.0
no shutdown
encapsulation frame-relay
no frame-relay inverse-arp
frame-relay map ip 192.168.1.1 201 broadcast
frame-relay map ip 192.168.1.3 201 broadcast
exit
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
R3:
interface s1/0
ip address 192.168.1.3 255.255.255.0
no shutdown
encapsulation frame-relay
no frame-relay inverse-arp
frame-relay map ip 192.168.1.1 301 broadcast
frame-relay map ip 192.168.1.2 301 broadcast
exit
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
路由配置
R1:
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
R2:
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
R3:
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
debug ip ospf adj
clear ip ospf process刷新ospf進程,重新計算
show ip ospf neighbor查看ospf鄰居
問題:只看到了down state,以後的鄰居關係就建立不了
原因:不支持廣播和組播,ospf路由器在建立鄰居關係的時候,第一個hello包使用的是組播,第二個纔是單播包,又因爲NBMA網絡不支持組播,所以才導致鄰居關係無法建立起來
默認情況下,參與到NBMA網路中的ospf接口模式爲non-broacast,都不支持廣播
show ip ospf interface s1/0
二、在NBMA網絡上運行OSPF解決方案
---------------------------------------------------------------------------
五種解決方法:在NBMA網絡上運行OSPF解決方案
工業標準
non-broadcast:保持默認的NBMA狀態
point-to-multipoint:點到多點
cisco標準
broadcast:模擬成廣播網絡
point-tomultipoint non-broadcast:點到多點非廣播
point-to-point:點到點網絡
show ip ospf inter s0/0 查看當前模式,默認是non-broadcast模式
----------------------------------------------------------------------------
--------------------------------------------------------------------------
方法一:NBMA模式:保持NBMA的接口模式去運行ospf,手動指定鄰居
-------------------------------------------------------------------------
要點:
默認就是non-broadcast模式,所以不需要去修改接口模式了
鄰居不能自動發現,必須通過neighbor命令手動指定鄰居,指定的是鄰居的RouterID
在NBMA網絡中,需要選舉DR和BDR的,如果拓撲是星型網絡,就要讓中心路由器成爲DR;如果是全互連的就無所謂了
通過修改接口優先級,優先級0代表該路由器永遠無法成爲DR或者BDR,1是路由器默認的接口優先級
時間計時器:deadtime---120秒hello間隔----30秒
1、幀中繼配置還是和上面一樣(DLCI複用)
2、修改接口模式:所有路由器在幀中繼的接口都要配置
ip ospf network non-broadcast
3、手動指定鄰居
R1:(中心路由器),我們只需要在這一臺路由器上指定鄰居就可以了,那是因爲在ospf建立鄰居關係的時候,第一個發送hello包使用的是組播地址,其他路由器再發送的時候使用的就是單播地址了,就不再需要組播,所以我們在中心路由器上指定鄰居完成第一個hello包的傳輸就可以了
手動指定路由器的兩個鄰居
router ospf 1
neighbor 192.168.1.2 必須使用鄰居路由器的router-id
neighbor 192.168.1.3
exit
4、手動調整優先級,使中心路由器成爲DR
R1
interface s0/0
ip ospf priority 25
或者
在指定鄰居的時候,將鄰居的優先級設置爲0
router ospf 1
neighbor 192.168.1.2 priority 0
neighbor 192.168.1.3 priority 0
5、在每臺路由器上刷新ospf進程重新計算DR
clear ip ospf process
查看鄰居關係
show ip ospf neighbor
-----實驗:證明在手動指定鄰居的時候我們使用的是鄰居物理接口地址還是鄰居的RouterID
創建兩個迴環接口
R2:
interface lo 0
ip address 2.2.2.2 255.255.255.255
no shutdown
ip ospf 1 area 0在接口上通過ospf路由
R3:
interface lo 0
ip address 3.3.3.3 255.255.255.255
no shutdown
ip ospf 1 area 0
clear ip ospf p 刷新ospf進程,重新計算RID
或者
手動指定RID
R2:
router ospf 1
router-id 2.2.2.2
R3:
router ospf 1
router-id 3.3.3.3
clear ip ospf process 刷新進程,讓RID生效
更改鄰居
router ospf 1
neighbor 192.168.1.2 鄰居路由器的RouterID
neighbor 192.168.1.3
exit
show ip ospf neighbor
deadtime:120秒
hello間隔:30秒
--------------------------------------------------------------------------
方法二:廣播模式--broadcast
-------------------------------------------------------------------------
要點:
鄰居是自動發現的
在星型拓撲中,中心路由器還是DR,配置和上述一樣
hello時間間隔是10秒;deadtime是40秒
在這種網絡中需要選舉DR/BDR
刪掉之前的OSPF路由
no router ospf 1
1、幀中繼配置和上面是一樣的(DLCI複用)
2、手動調整優先級,使中心路由器成爲DR
R1
interface s0/0
ip ospf priority 25
3、配置OSPF路由
router ospf 1
network area 0
4、將路由器所有在NBMA網絡中的接口類型修改爲broadcast
interface s1/0
ip ospf network broadcast
show ip ospf inter s1/0查看接口的網絡類型
-------------------------------------------------------------------------
方法三:點到點模式
中心路由器必須劃分成點到點子接口
-------------------------------------------------------------------------
hellotime是30秒,deadtime是120秒
不需要選舉DR和BDR
中心路由器必須劃分子接口,邊緣路由器可以使用物理接口,或者劃分子接口
劃分點到點子接口的路由器,不需要使用 ip ospf network point-to-point這條命令
IP編制需要重新規劃,使用兩個不同的子網
1、幀中繼配置(不用DLCI複用)
R1:
interface s1/0
en fr
no frame inver
no shutdown
interface s1/0.1 point-to-point
ip address 192.168.1.1 255.255.255.252
no shutdown
frame-relay interface-dlci 102
interface s1/0.2 point-to-point
ip address 192.168.1.5 255.255.255.252
no shutdown
frame-relay interface-dlci 103
router ospf 1
network 192.168.1.1 0.0.0.0 area 0
network 192.168.1.5 0.0.0.0 area 0
R2:
interface s0/0
en fr
no frame inver
ip address 192.168.1.2 255.255.255.252
no shut
frame-relay map ip 192.168.1.1 201 broadcast
ip ospf network point-to-point
router ospf 1
network 192.168.1.2 255.255.255.252 area 0正常通告
R3:
interface s0/0
en fr
no frame inver
ip address 192.168.1.6 255.255.255.252
no shut
ip ospf network point-to-point
frame-relay map ip 192.168.1.1 301 broadcast
ip ospf 1 area 0 OSPF的另外一種路由通告方式
-------------------------------------------------------------------------
方法四:點到多點模式
可以直接使用物理接口,也可以使用多點子接口
-------------------------------------------------------------------------
hellotime是30秒,deadtime是120秒
不需要選舉DR和BDR
不需要DLCI複用,但是運行了ospf之後,兩個spoke之間任意可以通信
自動產生一條多點幀中繼接口的主機路由,用於解決不使用DICI複用產生的端到端連通性問題
如果使用多點子接口代替物理接口,那麼多點子接口不需要使用 ip ospf network point-to-multipoint
清空所有路由器的配置
default s1/0
no router ospf 1
1、配置幀中繼,不使用DLCI的複用,運行ospf
R1:
interface s1/0
ip address 192.168.1.1 255.255.255.0
no shutdown
encapsulation frame-relay
no frame-relay inverse-arp
frame-relay map ip 192.168.1.2 102 broadcast
frame-relay map ip 192.168.1.3 103 broadcast
exit
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
R2:
interface s1/0
ip address 192.168.1.2 255.255.255.0
no shutdown
encapsulation frame-relay
no frame-relay inverse-arp
frame-relay map ip 192.168.1.1 201 broadcast
exit
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
R3:
interface s1/0
ip address 192.168.1.3 255.255.255.0
no shutdown
encapsulation frame-relay
no frame-relay inverse-arp
frame-relay map ip 192.168.1.1 301 broadcast
exit
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
2、更改接口模式,如果使用子接口就不需要
R1:
interface s1/0
ip ospf network point-to-multipoint
R2:
interface s1/0
ip ospf network point-to-multipoint
R3:
interface s1/0
ip ospf network point-to-multipoint
-------------------------------------------------------------------------
方法五:點到多點非廣播模式
跟點到多點模式相比,鄰居必須要手動指定,其他特點和點到多點一樣
-------------------------------------------------------------------------
要點:
hellotime是30秒,deadtime是120秒
不需要選舉DR和BDR
不需要DLCI複用,但是運行了ospf之後,兩個spoke之間任意可以通信
自動產生一條多點幀中繼接口的主機路由,用於解決不使用DICI複用產生的端到端連通性問題
如果使用多點子接口代替物理接口,那麼多點子接口不需要使用 ip ospf network point-to-multipoint
跟點到多點模式相比,必須要手動指定鄰居
1、幀中繼配置(無DLCI複用)
2、OSPF路由(和上面一樣)
3、手動指定路由器的兩個鄰居
router ospf 1
neighbor 192.168.1.2 鄰居接口的IP地址
neighbor 192.168.1.3
exit
4、更改接口模式,如果使用子接口就不需要
R1:
interface s1/0
ip ospf network point-to-multipoint
R2:
interface s1/0
ip ospf network point-to-multipoint
R3:
interface s1/0
ip ospf network point-to-multipoint