單區域OSPF路由協議實現網絡區域互通


1、什么是OSPF協議?

OSPF協議的全程是開放式最短路徑優先協議,協議采用鏈路狀態協議算法(LS協議)

 

2、OSPF vs RIP

RIP路由協議是距離矢量路由選擇協議,收斂速度慢,如果在一些大型網絡中使用RIP協議,要實現全區域網絡互通可能需要一點時間,因此,相較於RIP而言,OSPF路由協議更適合於大型網絡。

 

3、OSPF協議配置的過程(主要指令)

router ospf x             //開啟ospf協議(其中x代指OSPF路由進程ID)

router-id x.x.x.x        //指定路由器的Router ID

network x.x.x.x 反掩碼 area x      //宣告路由器各個接口所在網絡號及區域

 

4、要點提示

①OSPF路由進程ID的范圍必須是在1~65535,而且只有本地含義,不同路由器的進程ID可以是不同的,但如果要想啟動OSPF路由進程,至少確保有一個接口是UP的

②Router ID(區域ID)是在0~4294967295內的十進制數,也可以是IP地址格式x.x.x.x,當網絡的區域ID為0或0.0.0.0時稱為主干區域

確定Router ID遵循如下的原則:

         最優先的是在OSPF進程中用命令router-id指定路由器ID

         如果沒有在OSPF進程中指定路由器的ID,那么選擇IP地址最大的環回接口(loopback)的IP定為Router ID

         如果沒有環回接口(loopback),那么就選擇最大活動的物理接口IP地址作為Router ID(建議用命令router-id來指定路由器ID,這樣可控性比較好)

③關於反掩碼:簡言之就是255.255.255.0→0.0.0.255

 

實驗拓撲:

詳細配置:

R0:

enable

conf t

hostname R0

no ip domain-lookup

int loop 0

ip add 1.1.1.1 255.255.255.0

no shu

int f0/0

ip add 192.168.12.1 255.255.255.0

no shu

exit

router ospf 1

router-id 1.1.1.1

network 1.1.1.0 0.0.0.255 area 0

network 192.168.12.0 0.0.0.255 area 0

end

 

R1:

enable

conf t

no ip domain-lookup

hostname R1

int loop 0

ip add 2.2.2.2 255.255.255.0

no shu

int f0/0

ip add 192.168.12.2 255.255.255.0

no shu

int f0/1

ip add 192.168.23.1 255.255.255.0

no shu

exit

router ospf 1

router-id 2.2.2.2

network 2.2.2.0 0.0.0.255 area 0

network 192.168.12.0 0.0.0.255 area 0

network 192.168.23.0 0.0.0.255 area 0

end

 

R2:

enable

conf t

no ip domain-lookup

hostname R2

int loop 0

ip add 3.3.3.3 255.255.255.0

no shu

int f0/0

ip add 192.168.23.2 255.255.255.0

no shu

int f0/1

ip add 192.168.34.1 255.255.255.0

no shu

exit

router ospf 1

router-id 3.3.3.3

network 3.3.3.0 0.0.0.255 area 0

network 192.168.23.0 0.0.0.255 area 0

network 192.168.34.0 0.0.0.255 area 0

end

 

R3:

enable

conf t

no ip domain-lookup

hostname R3

int loop 0

ip add 4.4.4.4 255.255.255.0

no shu

int f0/0

ip add 192.168.34.2 255.255.255.0

no shu

exit

router ospf 1

router-id 4.4.4.4

network 192.168.34.0 0.0.0.255 area 0

network 4.4.4.0 0.0.0.255 area 0

end


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM